示例#1
0
        /// <summary>
        /// Callback from a new connection, the connection authenticated successfully so make the new connection the active connection
        /// </summary>
        /// <param name="newConnection"></param>
        public void AcceptConnection(TelnetConnection newConnection)
        {
            // If already an active connection, kick them off
            if (connection != null)
            {
                connection.Send("Connection aborted, another client has connected");
                connection.Shutdown();
                connection = null;
            }

            // Each new inbound connection is handled in a new thread by a new Connection object
            connection = newConnection;
            connection.CommandReceived += new TelnetCommandReceivedEventHandler(HandleCommandReceived);

            // Header
            connection.Send(String.Format("\x1B[2J\r\n{0} Telnet interface\r\n\r\n", MasterServer.Title));

            // Log tail
            if (MasterServer.Instance != null)
            {
                MasterServer.Instance.TailLog();
            }
        }
示例#2
0
 /// <summary>
 /// Handle a command received from the telnet interface
 /// </summary>
 /// <param name="receivedCommand"></param>
 /// <param name="sender"></param>
 void HandleCommandReceived(string receivedCommand, TelnetConnection sender)
 {
     ModuleManager.DispatchCommand(receivedCommand.Split(' '));
 }
示例#3
0
 /// <summary>
 /// Callback from a new connection, the connection failed authentication
 /// </summary>
 /// <param name="newConnection"></param>
 public void RejectConnection(TelnetConnection newConnection)
 {
     pendingConnections.Remove(newConnection);
     newConnection.Shutdown();
 }