suspending the task before closing it, resolved me a problem.
When I used to close a thread which has the command
Code:
int ret = soc.Receive(receive, receive.Length, 0);
gave the following Exception:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.ComponentModel.Win32Exception..ctor(Int32 error)
at System.Net.Sockets.SocketException..ctor()
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 size, SocketFlags socketFlags)
at MaleClient.FrmMain.RecieveData() in c:\documents and settings\erany\my documents\visual studio projects\matchmaker\maleclient\frmmain.cs:line 221