/// <summary> /// Closes the socket /// </summary> public void Close() { if (ConnectionSocket != null) { if (ConnectionSocket.Connected) { ConnectionSocket.Disconnect(true); } ConnectionSocket.Shutdown(SocketShutdown.Both); ConnectionSocket.Close(); } }
public virtual void Disconnect(bool allowReuse = false) { //Check not already Connected. if (((NetworkConnectionState)Flags).HasFlag(NetworkConnectionState.Connected)) { ConnectionSocket.Disconnect(allowReuse); base.Disconnect(); UnFlagConnected(); Refresh(); } }