Exemple #1
0
 /// <summary>
 /// Restarts the servers
 /// </summary>
 public void Restart()
 {
     lock (_syncRoot)
     {
         if (Started)
         {
             StopCore();
         }
         LogicServer = new TLogicServer();
         StartCore();
         Started = true;
         Log.Info("The server is restarted");
     }
 }
Exemple #2
0
 /// <summary>
 /// Stops the socket server. Sets logic server to instance of the <see cref="TNullLogicServer"/>
 /// </summary>
 public void Stop()
 {
     lock (_syncRoot)
     {
         if (!Started)
         {
             return;
         }
         Started = false;
         StopCore();
         LogicServer = new TNullLogicServer();
         Log.Info("The server is stopped");
     }
 }
Exemple #3
0
 /// <summary>
 /// Starts the socket server. Sets logic server to instance of the <see cref="TLogicServer"/>
 /// </summary>
 public void Start()
 {
     lock (_syncRoot)
     {
         if (Started)
         {
             return;
         }
         LogicServer = new TLogicServer();
         StartCore();
         Started = true;
         Log.Info("The server is started");
     }
 }
Exemple #4
0
 public WebSocketApp(Func <IWebSocketConnectionHandler> createConnectionHandler, string address = "127.0.0.1", int port = 5555)
 {
     this.createConnectionHandler = createConnectionHandler;
     handler      = this.createConnectionHandler();
     this.address = address;
     this.port    = port;
     this.cancellationTokenSource = new CancellationTokenSource();
     _msgQueue = ConnectionFactory.CreateLogicService();
     this._ws  = new WebSocketServer();
     if (_ws.Setup(this.port))
     {
         _ws.Start();
     }
     _ws.NewSessionConnected += OnClientConnected;
     _ws.NewMessageReceived  += OnMessageReceived;
     _ws.NewDataReceived     += OnDataReceivedAsync;
     _ws.SessionClosed       += OnClientClosed;
     //  _timerMsgQueue = new Timer(new TimerCallback(GetMsg), this, 0, 800);
 }
Exemple #5
0
 public AccountController()
 {
     _sign    = "123456789";
     _account = ConnectionFactory.CreateAccountService();
 }
Exemple #6
0
 protected BaseSocketServer()
 {
     LogicServer = new TNullLogicServer();
 }
Exemple #7
0
 public void SetLogicServer(ILogicServer _logic_server)
 {
     logic_server = _logic_server;
     logic_server.Init();
 }