I have a .NET Windows Forms based client server application using TCP sockets that exchange messages asynchronously during normal operation.
When a client is going to disconnect, it sends a message synchronously to the server saying that it is about to exit.
At this point it is guaranteed that no more messages will be sent from the server to this disconnecting client.
The client then does:
Socket.Shutdown( SocketShutdown.Both );
Socket.Close();
The form is then closed. At this point, although not always, the client who is disconnecting produces a Cannot access a disposed object exception whose stack trace points to the asynchronous receive module of my client's socket code.
Can anyone tell me what might be happening here?
Thank you in advance.
|