Does Socket.Shutdown() or Socket.Close() block?

  • Thread starter Thread starter PAzevedo
  • Start date Start date
P

PAzevedo

Hi there.

I called Socket.Select() on a group of sockets, and got one that was
writable.
On that socket i called Send() and sent a buffer of size smaller then
SendBufferSize that way Send() won't block.
Now right after that Send() i want to get ride of the socket but since
my server model isn't asynchronous i don't want to block.
So what should i do?
If i call Shutdown() and then Close() will either of them block? If
there is a way they won't block, will that way also guarantee the data
sent previously will reach it's destiny?


Thank you for your time.
 
[...]
If i call Shutdown() and then Close() will either of them block? If
there is a way they won't block, will that way also guarantee the data
sent previously will reach it's destiny?

Neither method will block. But there is no way to guarantee that the data
you passed to the Send method will arrive at the destination.

For what it's worth, you have no such guarantee even if you don't call
Shutdown or Close. The only way for the sender to know for sure what data
arrived at the destination is for that destination to report that explicitly
to the sender.

Pete
 
Back
Top