Subject: Re: [libssh2] #166: Some servers terminate connection due to large window adjustment

Re: [libssh2] #166: Some servers terminate connection due to large window adjustment

From: Jose Baars <>
Date: Thu, 25 Mar 2010 01:19:46 +0100

Op 3/24/2010 11:16 PM, libssh2 Trac schreef:

Thanks, I have been struggling with that too.

According to several sources on the web, for instance :

there is no use to enlarge the SSH protocol window above the
TCP/IP window size of the socket.

Problem is that I found it is not easy to find out what the socket
window size
is for a given socket, getsockopt has no SO_WINDOWSIZE or whatever.
Apparently, according to windows docs at ,
the maximum window size reachable is 1 Gb.

On the other hand RFC 4254 (SSH connection protocol) states in paragraph

  After receiving this message, the recipient MAY send the given number
    of bytes more than it was previously allowed to send; the window size
    is incremented. Implementations MUST correctly handle window sizes
    of up to 2^32 - 1 bytes. The window MUST NOT be increased above
    2^32 - 1 bytes.


The TCP/IP services VMS ssh server has a hard coded maximum window size
of 16 Mb, which is obviously not in accordance with RFC4254, but then again,
there is no specific guarantee or promise of it adhering to this or any other RFC.

The quick fix is the division by 10 and wouldn't break anything, although performance
on really fast connections with RFC compliant SSH servers (any out there?) might
suffer a performance impact.



Received on 2010-03-25