Mail Archives: djgpp/2000/10/21/07:36:14
On Sat, 21 Oct 2000, Peter Remmers wrote:
> Hi!
>
> I'm currently writing a telnet program and now have the problem
> that when I receive a relatively large amount of data (such as
> with "ls -lR /") after a few seconds it hangs, because
> the library thinks there is no data to read.
> select() hangs (or times out), recv() either blocks (blocking
> mode) or fails with EAGAIN (nonblocking).
This seems a typical result of the "closed window" syndrome.
I.e. the receiver buffer is overflooded and the window (in the
tcp-header) shrinks rapidly down to zero. The sender should
in this case "back-off" waiting for the receiver's window to open
again.
I suspect the application on the sending side isn't correctly handling
the send() fail (errno=EAGAIN?) in this case. The sending loop exits
and the effect is what you see.
> On my linux box (where I do the "ls -lR /") netstat says the
> send-Q of the connetion fills up to like 40k or so.
Because the Winsock (?) isn't opening the tcp-window again *OR* the
application isn't flushing it's receive-buffer.
All in all, the fault could be on either side (but it's hard to believe
Winsock solely is to blame). You should use tcpdump or similar tools
to see exactly whats going on.
Gisle V.
- Raw text -