Subject: Re: Problem with random delay in terminal

Re: Problem with random delay in terminal

From: Lars Nordin <Lars.Nordin_at_SDlabs.se>
Date: Tue, 26 Jan 2016 22:39:12 +0100

On 2016-01-26 21:40, Lars Nordin wrote:
> On 2016-01-26 20:37, Daniel Stenberg wrote:
>> On Tue, 26 Jan 2016, Lars Nordin wrote:
>>
>>> Have I missed any setting? I know local_echo is an option, but if
>>> SecureCRT can, why not libssh2?
>>
>> Could it be as easy as setsockopt(... TCP_NODELAY ...) ?
>> _______________________________________________
>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
> I added the line, but no change...I'm on Windows and tried both the
> ioctlsocket(... FIONBIO ... and now the setsockopt(... TCP_NODELAY ...)
> u_long flags = 1;
>
> //ioctlsocket(sock, FIONBIO, &flags); // tried both with and
> without
> setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &flags,
> sizeof (u_long));
>
> Using my automatic character-sender I discovered a pattern, the ACK is
> sent after 14 packetets, ie 7 characters sent and received. The delay
> is 100ms (as programmed) between each sent characters (with a reply in
> less then 10ms) until the ACK , the ACK is sent efter 200ms delay and
> then the next character after 100ms more. Summary 200ms of extra delay
> each 7 characters sent.
>
> /Lars
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
I added code to print the clock() before and after the call to libssh2
and discovered that it's the libssh2_write() function that sometime
takes extre time to complete:
write<: clock (ms) = 2042
write>: clock (ms) = 2042
read <: clock (ms) = 2042
read >: clock (ms) = 2042
write<: clock (ms) = 2143
write>: clock (ms) = 2143
read <: clock (ms) = 2143
read >: clock (ms) = 2143
write<: clock (ms) = 2243
write>: clock (ms) = 2448

Above explained, the 'write <' is before the call to write and 'write >'
is after the call. I have a 100ms delay between each write() and the
function is not using any time until the last one . Checking all of the
output it's repeated each 7 write.

I dig inte the libssh2_write() tomorrow!

/Lars
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-01-26