I have this code...
internal static void Start() { TcpListener listenerSocket = new TcpListener(IPAddress.Any, 32599); listenerSocket.Start(); listen
try this one. it works fine for me without catching exceptions.
private void OnAccept(IAsyncResult pAsyncResult) { TcpListener listener = (TcpListener) pAsyncResult.AsyncState; if(listener.Server == null) { //stop method was called return; } ... }