This project has moved. For the latest updates, please go here.

System.ObjectDisposedException

Sep 28, 2012 at 9:26 PM

Alright. I have written a test client that I connect 10 clients to the server from 10 different machines. The server is also on its own machine. Each client send a message to the server every 200ms. After running for about 10 minutes. This Unhandled exception comes up. The client is just a simple console just like your example. The only difference is I have a timer that send a message to the server every 200ms. Once this error happens you can see funny behavior on your server test form with the number of connection. It goes 10 then to 11 then to 12 back down to 10. So on and so forth.

Thanks,
Mike

 

************** Exception Text **************
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
   at System.Net.Sockets.Socket.get_RemoteEndPoint()
   at Nito.Async.Sockets.TcpSocketImpl.get_RemoteEndPoint() in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async.Sockets\TcpSockets.cs:line 310
   at Nito.Async.Sockets.ServerChildTcpSocket.get_RemoteEndPoint() in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async.Sockets\TcpSockets.cs:line 863
   at ServiceSimulationWinForm.Form1.ChildSocket_PacketArrived(ServerChildTcpSocket socket, AsyncResultEventArgs`1 e) in C:\Documents and Settings\mbrown\my documents\visual studio 2010\Projects\TCPIP\ServiceSimulationWinForm\Form1.cs:line 268
   at ServiceSimulationWinForm.Form1.<>c__DisplayClass6.<ListeningSocket_AcceptCompleted>b__0(AsyncResultEventArgs`1 args) in C:\Documents and Settings\mbrown\my documents\visual studio 2010\Projects\TCPIP\ServiceSimulationWinForm\Form1.cs:line 89
   at Nito.Async.Sockets.SocketPacketProtocol.SocketReadCompleted(AsyncResultEventArgs`1 e) in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async.Sockets\SocketPacketProtocol.cs:line 141
   at Nito.Async.Sockets.ServerChildTcpSocket.<.ctor>b__0(AsyncResultEventArgs`1 e) in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async.Sockets\TcpSockets.cs:line 816
   at Nito.Async.Sync.InvokeAndCallback[T](Func`1 action, Action`1 callback, Object state) in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async\EventHandlers.Sync.cs:line 70
   at Nito.Async.Sockets.TcpSocketImpl.<ReadAsync>b__4(IAsyncResult asyncResult) in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async.Sockets\TcpSockets.cs:line 388
   at Nito.Async.Sync.<>c__DisplayClass1e.<>c__DisplayClass20.<SynchronizeAsyncCallback>b__1d(Object unusedState) in C:\Documents and Settings\mbrown\My Documents\Downloads\Nito.Async.1.4\Source\Nito.Async\Sync.cs:line 145