Just to add a bit to the description of the problem - the
problem only happens when wsoNoReceiveLoop is used.

- The connection is not closed but there's no data coming in.
  This typically happens after a few MByte of data has been
  transferred.
  
- I log Pause and Resume calls so that I see them rolling in
  DebugView window. When the problem happens, no more pause
  and resume show in the log window The last one is always
  a Resume. So, when the problem happens, it seems that either
  the TCP stack fails to receive more data, or the TWSocket
  object fails to call OnDataAvailable event.

- I could not reproduce the problem with httpprot component.
  (I could only test httpprot against a web server, which is a
  different server box with different OS. Not sure if it has
  anything to do with the difference in TCP stacks. One Windows,
  one Linux + proprietary software)

===8<==============Original message text===============
Hi Francois,

> As far as I know, "TCP zero window" is sent when the comiter is not able to
> receive data anymore because the receive buffer is full. And still as far as
> I know this is not an error if it doesn't persist for too long. It is simply
> part of the control flow in TCP protocol.

> Speaking about your application: are you sure you still receive data ? From
> OnDataAvailable event handler, you must receive everything or you enter an
> infinite loop when wsoNoReceiveLoop is not activated and if activated but
> you don't call Receive, then you don't get any notification before you cxall
> Receive.

Yes, without wsoNoReceiveLoop, I'm able to receive the whole 200MB
file. With wsoNoReceiveLoop, it breaks in the middle. It's yet to
find out why

I think my code works similarly to httpprot, with the exception
of having wsoNoReceiveLoop commented out. The client receives everything
in the OnDataAvailable handler, calculates the bandwith, if too high,
calls Pause. Then in a timer, when the average bandwidth drops, Resume
is called.

You and Wilfried explained that wsoNoReceiveLoop stops the loop.
I thought Pause does this as well? When Pause is called, am I supposed
to get OnDataAvailable events? I guess I'm not clear on how
wsoNoReceiveLoop interacts with Pause and Resume.

> If you call Pause, obviously you are no more notifyed when data comes in.
> This will fill the receive buffer until full and at that time the peer will
> recive the zero window message. Before timeout you must call resume and
> probably Receive as well to restart the receiving process.

Yes, resume is called in a timer handler, similar to httpprot.

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to