Exemplo n.º 1
0
        /// <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;
            }
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 /// <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
 }