private void TryShutdown(IAsyncResult ar) { try { Socket.EndDisconnect(ar); ShutdownCompleted?.Invoke(this, new TcpCompletedEventArgs()); } catch (Exception ex) { var eventArgs = new TcpCompletedEventArgs(ex); eventArgs.Error = true; ShutdownCompleted?.Invoke(this, eventArgs); } }
private void Socket_ShutdownCompleted(object sender, TcpCompletedEventArgs e) { ShutdownCompleted?.Invoke(sender, e); }
public void Shutdown() { IsShuttingDown = true; OnShutdown(); ShutdownCompleted?.Invoke(this, EventArgs.Empty); }