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; } }