private bool DoCloseConnection() { if (RemoteState != null) { RemoteState.GotDataToSend -= RemoteState_GotDataToSend; RemoteState.Close(); RemoteState = null; return(true); } else { return(false); } }
public void Disconnect() { if (RemoteState != null && RemoteState.Close()) { RemoteState = null; try { //Signal that we got disconnected if (Disconnected != null) { Disconnected(this, new NetworkEventArgs(Hostname, Port)); } } catch { } } }