C# Socket.BeginSend AsyncCallback behavior (timeout?)
Posted
by mdarsigny
on Stack Overflow
See other posts from Stack Overflow
or by mdarsigny
Published on 2010-03-18T22:24:48Z
Indexed on
2010/03/18
23:01 UTC
Read the original article
Hit count: 1431
Hi guys,
Here is a scenario with asynchronous sockets that I dont't quite understand... I have 2 Tcp sockets, a client socket & a server socket. My server socket is bound & listening on a port.
My client sockets connect to the server socket (using BeginConnect / EndConnect). I then send a message to the server using BeginSend(). On the server side, I don't do a Receive() or BeginReceive().
What happens is that my AsyncCallback specified for my BeginSend call gets invoked & its IAsyncResult tells me that it completed & the call to Socket.EndSend() does not raise any exception...
Is there something that I don't get or shouldn't my AsyncCallback be called only if the BeginSend call actually sends something to the server (ie.: callback called after the server has received all bytes)? If there was no receive done on the server, shouldn't my callback be called after the sendtimeout expires and my call to Socket.EndSend then would raise an exception?
Thanks
© Stack Overflow or respective owner