public virtual void Disconnect(bool ANotifyPeer) { try { if (ANotifyPeer) { if (Connected()) { DisconnectNotifyPeer(); } } } finally { if (mSocket != null) { if (mSocket.Connected()) { // DoStatus(StatusEnum.Disconnecting); mSocket.Close(); DoOnDisconnected(); // DoStatus(StatusEnum.Disconnected); } } } }
public virtual bool Connected() { return ((Socket != null) && (Socket.Connected()) ); }