<s>
In	O
computing	O
,	O
Mosh	B-Protocol
(	O
mobile	O
shell	O
)	O
is	O
a	O
tool	O
used	O
to	O
connect	O
from	O
a	O
client	O
computer	O
to	O
a	O
server	O
over	O
the	O
Internet	O
,	O
to	O
run	O
a	O
remote	O
terminal	B-Application
.	O
</s>
<s>
Mosh	B-Protocol
is	O
similar	O
to	O
SSH	B-Protocol
,	O
with	O
additional	O
features	O
meant	O
to	O
improve	O
usability	O
for	O
mobile	O
users	O
.	O
</s>
<s>
Mosh	B-Protocol
maintains	O
its	O
session	O
even	O
when	O
it	O
"	O
roams	O
"	O
(	O
when	O
the	O
client	O
endpoint	O
changes	O
to	O
different	O
IP	B-Protocol
addresses	O
)	O
,	O
for	O
example	O
by	O
moving	O
to	O
a	O
different	O
Wi-Fi	O
network	O
or	O
when	O
changing	O
from	O
Wi-Fi	O
to	O
3G	B-Architecture
.	O
</s>
<s>
Mosh	B-Protocol
maintains	O
the	O
terminal	B-Application
session	O
(	O
not	O
"	O
connection	O
"	O
in	O
the	O
TCP-sense	O
because	O
Mosh	B-Protocol
uses	O
UDP	B-Protocol
)	O
even	O
when	O
a	O
user	O
loses	O
their	O
Internet	O
connection	O
or	O
puts	O
their	O
client	O
to	O
"	O
sleep	O
"	O
.	O
</s>
<s>
In	O
comparison	O
,	O
SSH	B-Protocol
can	O
lose	O
its	O
connection	O
in	O
such	O
cases	O
because	O
TCP	B-Protocol
times	O
out	O
.	O
</s>
<s>
Mosh	B-Protocol
client	O
attempts	O
to	O
be	O
responsive	O
to	O
keyboard	O
events	O
(	O
typing	O
,	O
erasing	O
characters	O
with	O
the	O
key	O
,	O
and	O
so	O
on	O
)	O
without	O
waiting	O
for	O
network	O
lag	O
.	O
</s>
<s>
It	O
uses	O
an	O
adaptive	O
system	O
that	O
predicts	O
whether	O
the	O
application	O
running	O
on	O
the	O
server	O
will	O
decide	O
to	O
echo	B-Error_Name
the	O
user	O
's	O
keystrokes	O
or	O
deletions	O
.	O
</s>
<s>
The	O
main	O
drawbacks	O
of	O
mosh	B-Protocol
are	O
additional	O
prerequisites	O
to	O
the	O
server	O
,	O
that	O
it	O
lacks	O
some	O
special	O
features	O
of	O
SSH	B-Protocol
(	O
such	O
as	O
connection	O
forwarding	O
)	O
and	O
the	O
lack	O
of	O
a	O
native	B-Language
Windows	B-Application
client	O
.	O
</s>
<s>
An	O
alternative	O
for	O
Linux	O
servers	O
(	O
that	O
still	O
require	O
installation	O
on	O
the	O
server	O
)	O
is	O
to	O
use	O
GNU	B-Application
Screen	I-Application
on	O
top	O
of	O
a	O
regular	O
SSH	B-Protocol
connection	O
.	O
</s>
<s>
Mosh	B-Protocol
works	O
at	O
a	O
different	O
layer	B-Architecture
from	O
SSH	B-Protocol
.	O
</s>
<s>
Whereas	O
SSH	B-Protocol
transmits	O
a	O
stream	O
of	O
bytes	O
in	O
each	O
direction	O
(	O
from	O
server	O
to	O
client	O
or	O
client	O
to	O
server	O
)	O
using	O
TCP	B-Protocol
,	O
Mosh	B-Protocol
runs	O
a	O
terminal	B-Application
emulator	I-Application
at	O
the	O
server	O
to	O
figure	O
out	O
what	O
should	O
be	O
on	O
the	O
screen	B-Application
.	O
</s>
<s>
The	O
server	O
then	O
transmits	O
this	O
screen	B-Application
to	O
the	O
client	O
at	O
a	O
varying	O
frame	O
rate	O
,	O
depending	O
on	O
the	O
speed	O
of	O
the	O
network	O
.	O
</s>
<s>
This	O
allows	O
Mosh	B-Protocol
to	O
save	O
on	O
network	O
traffic	O
on	O
slow	O
or	O
intermittent	O
connections	O
.	O
</s>
<s>
Mosh	B-Protocol
is	O
available	O
for	O
most	O
Linux	B-Application
distributions	I-Application
,	O
macOS	B-Application
,	O
FreeBSD	B-Operating_System
,	O
NetBSD	B-Device
,	O
and	O
OpenBSD	B-Operating_System
,	O
Android	B-Application
,	O
Solaris	B-Application
,	O
Cygwin	B-Language
,	O
and	O
as	O
a	O
Chrome	B-Operating_System
App	I-Operating_System
.	O
</s>
<s>
The	O
iOS	B-Application
program	O
Termius	O
includes	O
an	O
independent	O
implementation	O
of	O
the	O
Mosh	B-Protocol
protocol	O
.	O
</s>
<s>
Mosh	B-Protocol
is	O
built	O
on	O
the	O
State-Synchronization	O
Protocol	O
(	O
SSP	O
)	O
,	O
which	O
supports	O
single-packet	O
roaming	O
.	O
</s>
<s>
After	O
the	O
client	O
has	O
switched	O
to	O
a	O
new	O
IP	B-Protocol
address	O
,	O
a	O
single	O
packet	O
that	O
successfully	O
reaches	O
the	O
server	O
is	O
enough	O
to	O
"	O
roam	O
"	O
the	O
connection	O
.	O
</s>
<s>
(	O
The	O
client	O
may	O
be	O
using	O
NAT	B-Protocol
and	O
the	O
NAT	B-Protocol
roamed	O
instead	O
.	O
)	O
</s>
<s>
In	O
the	O
Mosh	B-Protocol
research	O
paper	O
,	O
the	O
creators	O
tested	O
SSP	O
on	O
a	O
link	O
with	O
29%	O
packet	O
loss	O
,	O
and	O
found	O
that	O
SSP	O
reduced	O
the	O
average	O
response	O
time	O
by	O
a	O
factor	O
of	O
50	O
(	O
from	O
16.8	O
seconds	O
to	O
0.33	O
seconds	O
)	O
compared	O
with	O
SSH	B-Protocol
,	O
which	O
uses	O
TCP	B-Protocol
.	O
</s>
<s>
According	O
to	O
Mosh	B-Protocol
's	O
developers	O
,	O
the	O
program	O
was	O
found	O
to	O
be	O
able	O
to	O
predict	O
and	O
immediately	O
display	O
70%	O
of	O
user	O
keystrokes	O
,	O
reducing	O
the	O
median	O
response	O
time	O
to	O
a	O
keystroke	O
to	O
less	O
than	O
5	O
milliseconds	O
(	O
masking	O
the	O
latency	O
of	O
the	O
network	O
)	O
.	O
</s>
<s>
A	O
different	O
study	O
,	O
by	O
students	O
at	O
Stanford	O
University	O
,	O
found	O
that	O
Mosh	B-Protocol
was	O
able	O
to	O
quickly	O
echo	B-Error_Name
55%	O
of	O
user	O
keystrokes	O
.	O
</s>
<s>
Compared	O
to	O
the	O
more	O
popular	O
SSH	B-Protocol
,	O
mosh	B-Protocol
has	O
the	O
following	O
drawbacks	O
:	O
</s>
<s>
The	O
major	O
drawback	O
of	O
mosh	B-Protocol
is	O
that	O
it	O
requires	O
the	O
server	O
to	O
fulfill	O
additional	O
prerequisites	O
which	O
are	O
not	O
needed	O
by	O
ssh	B-Protocol
itself	O
.	O
</s>
<s>
Due	O
to	O
its	O
design	O
,	O
mosh	B-Protocol
needs	O
the	O
server	O
to	O
allow	O
direct	O
connections	O
via	O
UDP	B-Protocol
.	O
</s>
<s>
Servers	O
not	O
fulfilling	O
these	O
prerequisites	O
cannot	O
be	O
used	O
by	O
mosh	B-Protocol
.	O
</s>
<s>
Examples	O
of	O
such	O
systems	O
include	O
servers	O
behind	O
firewalls	O
which	O
restrict	O
connections	O
to	O
the	O
ssh-port	O
via	O
TCP	B-Protocol
.	O
</s>
<s>
The	O
latter	O
is	O
usually	O
accommodated	O
by	O
ssh	B-Protocol
via	O
the	O
'	O
ProxyCommand	O
 '	O
option	O
,	O
but	O
this	O
is	O
not	O
supported	O
by	O
mosh	B-Protocol
.	O
</s>
<s>
By	O
default	O
,	O
the	O
server	O
tries	O
to	O
allocate	O
the	O
first	O
free	O
UDP	B-Protocol
port	O
in	O
the	O
range	O
60001	O
–	O
61000	O
,	O
per	O
connection	O
.	O
</s>
<s>
A	O
significant	O
part	O
of	O
the	O
firewall-filtering	O
happens	O
through	O
connection	O
tracking	O
,	O
so	O
called	O
stateful	O
filtering	O
,	O
this	O
is	O
based	O
on	O
the	O
SYN/ACK	O
flags	O
in	O
TCP	B-Protocol
segments	O
,	O
UDP	B-Protocol
packets	I-Protocol
do	O
n't	O
have	O
such	O
flags	O
.	O
</s>
<s>
Scrollback	O
is	O
not	O
supported	O
in	O
the	O
current	O
release	O
of	O
mosh	B-Protocol
,	O
and	O
when	O
using	O
it	O
in	O
a	O
terminal	B-Application
emulator	I-Application
with	O
scrollbars	O
they	O
disappear	O
,	O
but	O
is	O
planned	O
for	O
the	O
1.3	O
release	O
.	O
</s>
<s>
One	O
way	O
to	O
mitigate	O
this	O
currently	O
is	O
by	O
using	O
mosh	B-Protocol
in	O
combination	O
with	O
a	O
terminal	B-Application
multiplexer	O
like	O
screen	B-Application
or	O
tmux	B-Language
.	O
</s>
<s>
ssh-agent	O
forwarding	O
is	O
not	O
currently	O
supported	O
.	O
</s>
<s>
X11	B-Operating_System
Forwarding	O
is	O
not	O
yet	O
supported	O
.	O
</s>
