Best Answer David Karlas, 15 January 2014 - 11:36 AM
I suggest you using socket.Poll(1000,SelectMode.Read); for more details see http://msdn.microsof...y/cc532890.aspx
So instead of socket.Accept() do this:
class MyTcpListener;
{
public bool StopListening=false;
private Socket socket;
public Socket Accept()
{
while(!socket.Poll(1000,SelectMode.Read))
{
if(StopListening)
return null;
}
return socket.Accept();
}
}
Ofcource this is pretty stupid example you can do much better...
Go to the full post