Finish typing the command and it should all work. Now either reconnect the network or turn on your phone’s hot spot or otherwise connect to a different network. Type some more of the command and you’ll see the speculative characters show up underlined (see below the red cursor indicates the connection is currently not up). Now disconnect your network (pull the cable or shut off your wireless). For example, consider you are going to enter this command: find / -name 'mosh*' -print If you want to see the behavior firsthand, open up a Mosh session and start typing on a shell prompt. All this works well, but you can turn predictions off if you wish. Then it will go back to not performing the local echo until it is once again correctly predicting. When data comes back from the host computer that validates the guess as correct, Mosh will display the epoch and continue to display its guesses until something (like an up or down arrow) changes the epoch. Certain characters (like the up and down arrow) heuristically start new epochs.įor example, if you start typing inside emacs (or vi), you will start building an epoch that does not display on the screen. The software gathers batches of predicted input (epochs) that it validates (or refutes) as a group. Of course, there’s a chance it is wrong, so it underlines guesses until they are proven right. It also expects certain behavior of keys like backspace, right arrow, and left arrow. If the network isn’t robust, Mosh will presume that most characters will appear at the current cursor location. When you type something in Mosh, it might make a prediction. In fact, if you switch networks or if your computer sleeps and wakes up, Mosh will stay “connected.” Because Mosh doesn’t send data you won’t see, you can easily interrupt a long scrolling output (Mosh selects a frame rate for scrolling based on the network connection’s quality). Unlike SSH, Mosh uses UDP datagrams so packet loss isn’t a big deal. Mosh handles echo locally and also predicts certain things like insertion and deletion of characters. While this is useful to know the server is there, it isn’t good for responsiveness. For example, in SSH every character you type echos through the server. In addition, the client keeps its own notion of the screen and it attempts to handle some operations locally. The Mosh server has a system that synchronizes the screen, so it doesn’t waste time sending characters that won’t really appear to the user. Using Mosh is pretty similar to using SSH (and, in fact, you can use SSH to initially launch Mosh). One part works as a server while the other is the client application. To combat these and other problems, you might consider an open source program called Mosh (mobile shell). When your IP address can change (for example, roaming on a cellular network), SSH has problems, too. However, if you have a system out in a swamp somewhere with intermittent slow network access, SSH can be a real pain. If you are connected to your Raspberry Pi via a cable or a wireless router a few feet away, SSH can provide you with an encrypted connection straight to the box. With so many systems depending on Linux, the secure shell SSH has become a staple for many developers.
0 Comments
Leave a Reply. |