private void runSocket() { while (isRunning) { try { datagramQueue.ReadFrom(socket); } catch { return; } } }
private void runSocket() { while (isRunning) { try { datagramQueue.ReadFrom(listenSocket); } catch { // if we close the socket during a ReceiveFrom, it will throw an exception // so handle that exception by returning (and stopping the thread) return; } } }
private void runSocket() { while (true) { try { datagramQueue.ReadFrom(internalSocket); } catch (Exception e) { if (e is SocketException) { var socketException = e as SocketException; if (socketException.SocketErrorCode == SocketError.ConnectionReset) { continue; } } return; } } }