im kinda using ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconnon-blockingserversocketexample.htm

as my example to socket programming

for u that dont have msdn = http://msdn.microsoft.com/library/de...ketexample.asp


I am getting an error of

System.ObjectDisposedException: Cannot access a disposed object named "System.Net.Sockets.Socket".
Object name: "System.Net.Sockets.Socket".
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at SpiderCheck.Class1.ReceiveCallback(IAsyncResult ar) in C:\Development\SpiderManager\SpiderCheck\Class1.vb:line 165

I know what the problem is however im not sure on how to resolve it
The problem is that the socket is getting dropped when the thread is terminated and that the BeginReceive method still has information coming in.

This works ok when its a single call to the server but i need to run my methods within a loop, this is where the problem is caused.

Could anyone advise on how to resolve this issue. ask if you wish to see the code snippets


Thanks in advance

Carl