public void Shutdown() { sendQueue.ShutdownGracefully(); recvQueue.ShutdownGracefully(); socket.Shutdown(SocketShutdown.Send); SenderTask.Wait(); ReceiverTask.Wait(); }
public void Disconnect() { CancellationSource.Cancel(); if (SenderTask != null) { SenderTask.Wait(); SenderTask = null; } if (ReceiverTask != null) { ReceiverTask.Wait(); ReceiverTask = null; } if (Socket != null) { Socket.Close(); Socket = null; } }
public void Disconnect() { CancellationSource.Cancel(); if (SenderTask != null) { // Remove this line and se if that fix the problem. // SenderTask.Wait(); SenderTask = null; } if (ReceiverTask != null) { ReceiverTask.Wait(); ReceiverTask = null; } if (Socket != null) { // Socket.Close(); Socket = null; } }