I am making an server/client application.
I set server socket to listening, and set BeginAccept() method. And when I closed server socket (Socket.Close()) to turn off server, an exception thrown from BeginAccept() method's async callback method. I inspected exception, and I found the exception saying me this:
Message "Cannot access a disposed object named "System.Net.Sockets.Socket". Object name: "System.Net.Sockets.Socket"." String
In my opinion, this is just this: "The socket disposed when I call Socket.Close() method, but the callback did not released before the socket closed."
i did search on the net and found this is not an error but a designed exception as beginaccept was cancelled.
my question how do i handle this excepton? what processing there needs to be for it?
thanks.
im just going to treat it as a normal event:
OnNetworkEvents eventArgs = new OnNetworkEvents(false, "Ready", e.Message);
OnUpdateNetworkStatusMessage(this, eventArgs);
any comments are still welcome.