/// <summary> /// Disposes of resources. /// </summary> public void Dispose() { if (tcpServer != null) { tcpServer.Stop(); tcpServer.DisconnectAll(); tcpServer = null; } if (secureTcpServer != null) { secureTcpServer.Stop(); secureTcpServer.DisconnectAll(); secureTcpServer = null; } }
public void Disconnect(string args) { try { if (server == null) { CrestronConsole.PrintLine("Server is already disconnected"); return; } if (args == "") { // When no arguments are provided, disconnect from all clients and destroy the server server.DisconnectAll(); CrestronConsole.PrintLine("Server has disconnected from all clients and is no longer listening on port " + server.PortNumber); server = null; } else { // Disconnect from the client specified by the user uint clientIndex = uint.Parse(args); if (server.ClientConnected(clientIndex)) { server.Disconnect(clientIndex); CrestronConsole.PrintLine("Server has disconnected from " + clientIndex); } else { CrestronConsole.PrintLine("Client #" + clientIndex + " does not exist currently"); } } } catch (Exception e) { PrintAndLog("Error in Disconnect: " + e.Message); } }
/// <summary> /// Disconnect All Clients /// </summary> public void DisconnectAllClients() { Debug.Console(2, "Disconnecting All Clients"); if (SecureServer != null) { SecureServer.DisconnectAll(); } if (UnsecureServer != null) { UnsecureServer.DisconnectAll(); } onConnectionChange(); onServerStateChange(); //State shows both listening and connected }