DZ-Jay wrote:
> On Oct 18, 2007, at 02:35, Arno Garrels wrote:
>> Your code does not guarantee that all data will be sent
>> to the client. Make sure that ShutDown() is called after
>> all data has been delivered to winsock. Something like
>> that:
> Thanks Arno.  But now I'm confused:  It was because I was told to call
> Shutdown(1) that I used it when closing the connection.
> I was told on this list that that's what I should do to ensure that the 
> closing
> message data is delivered before closing the connection.  Was this not
> accurate?

That was correct, only Shutdown() should be called after all data that might
still be waiting for delivery in the _component_ send buffer has been delivered
to the underlaying socket.
When you call any of the send-functions data is first copied into the internal
send buffer of the component, real sending the happens in the background.
So real sending may be delayed depending on how much you sent or on how many 
is still hanging in the _component_ send buffer.
ShutDown(1) only guarantees that any data delivered to the underlaying socket 
will be sent to the client, it does not guarantee component's send buffer is
fully sent and empty, so calling ShutDown(1) in event OnDataSent is an ideal
place. Btw: If for some reason TWSocket would try so send something after
Shutdown() has been called a SocketException is raised.

Arno Garrels [TeamICS]


To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to