Пример #1
0
 private void TelnetServer_SessionClosed(TelnetAppSession session, CloseReason value)
 {
     if (sessionDic.ContainsKey(session.SessionID))
     {
         sessionDic[session.SessionID].stopSession();
         sessionDic.Remove(session.SessionID);
     }
 }
Пример #2
0
        private void appServer_NewSessionConnected(TelnetAppSession session)
        {
            session.sendNoNewLine(string.Format("Welcome to digital brain telnet server{0}Server Info: Address: {1},Port: {2}{3}Time: {4}{5}",
                                                System.Environment.NewLine, session.LocalEndPoint.Address.MapToIPv4(), session.Config.Port, System.Environment.NewLine,
                                                session.StartTime.ToString(), System.Environment.NewLine + session.PropmtSymbol));
            ProxyUserSession proxyUserSession = new ProxyUserSession(_fsmConfiguration);

            sessionDic.Add(session.SessionID, proxyUserSession);
        }
Пример #3
0
 private void printHelp(TelnetAppSession session, StringRequestInfo requestInfo)
 {
     foreach (var item in baseActionDic)
     {
         if (item.Key.Length != 0)
         {
             session.Send(item.Key);
         }
     }
     session.sendPropmt();
 }
Пример #4
0
 private void appServer_NewRequestReceived(TelnetAppSession session, StringRequestInfo requestInfo)
 {
     #region async
     if (requestInfo.Key.Length != 0)
     {
         LogHelper.WriteLog(string.Format("client:{1} send requset msg: [{0}]", requestInfo.Key + (requestInfo.Parameters.Length == 0 ? " " : string.Join(" ", requestInfo.Parameters))
                                          , session.LocalEndPoint.Address.MapToIPv4()));
     }
     Task.Run(() =>
     {
         if (sessionDic.ContainsKey(session.SessionID))
         {
             sessionDic[session.SessionID].SessionRequsetHandle(session, requestInfo);
         }
     });
     #endregion
     //TODO  maybe for  preformance reason need make it async Run
     //if (sessionDic.ContainsKey(session.SessionID))
     //{
     //    sessionDic[session.SessionID].SessionRequsetHandle(session, requestInfo);
     //}
 }
Пример #5
0
 private void sessionClose(TelnetAppSession session, StringRequestInfo requestInfo)
 {
     session.Close();
 }
Пример #6
0
        //public delegate void undateFSMConfiguration();

        #region BaseCommand
        private void sendPromt(TelnetAppSession session, StringRequestInfo requestInfo)
        {
            session.sendPropmt();
        }