示例#1
0
 public void startService()
 {
     try
     {
         Console.WriteLine(Convert.ToInt32(this.CloudPort));
         server      = new transportServer(Convert.ToInt32(this.CloudPort));
         sockests    = new List <TcpClient>();
         reqListener = new transportServer.NewClientHandler(newClientRequest);
         msgListener = new transportServer.NewMsgHandler(newMessageRecived);
         server.OnNewClientRequest  += reqListener;
         server.OnNewMessageRecived += msgListener;
         if (server.isStarted())
         {
             addLog(this.logs, Constants.SERVICE_START_OK, Constants.LOG_INFO);
         }
         else
         {
             addLog(this.logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
         }
     }
     catch
     {
         addLog(this.logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
     }
 }
示例#2
0
        public void stopServer()
        {
            foreach (KeyValuePair <string, TcpClient> entry in clientSockets)
            {
                server.endConnection(entry.Value);
            }

            server.OnNewClientRequest  -= reqListener;
            server.OnNewMessageRecived -= msgListener;
            reqListener = null;
            msgListener = null;
            server.stopServer();
            server = null;
        }
示例#3
0
        public void stopServer()
        {
            foreach (KeyValuePair<string, TcpClient> entry in clientSockets)
            {
                server.endConnection(entry.Value);
            }

            server.OnNewClientRequest -= reqListener;
            server.OnNewMessageRecived -= msgListener;
            reqListener = null;
            msgListener = null;
            server.stopServer();
            server = null;
        }
示例#4
0
 public void startService()
 {
     try
     {
         Console.WriteLine(Convert.ToInt32(this.CloudPort));
         server = new transportServer(Convert.ToInt32(this.CloudPort));
         sockests = new List<TcpClient>();
         reqListener = new transportServer.NewClientHandler(newClientRequest);
         msgListener = new transportServer.NewMsgHandler(newMessageRecived);
         server.OnNewClientRequest += reqListener;
         server.OnNewMessageRecived += msgListener;
         if (server.isStarted())
         {
             addLog(this.logs, Constants.SERVICE_START_OK, Constants.LOG_INFO);
         }
         else
         {
             addLog(this.logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
         }
     }
     catch
     {
         addLog(this.logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
     }
 }