Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            _server = new TcpSocketServer("127.0.0.1", 6666);

            _server.OnAcceptCompletedEvent += Server_OnAcceptCompletedEvent;

            _server.OnCloseCompletedEvent += Server_OnCloseCompletedEvent;

            _server.OnDisconnectClientCompletedEvent += Server_OnDisconnectClientCompletedEvent;

            _server.OnReceiveCompletedEvent += Server_OnReceiveCompletedEvent;

            _server.OnSendCompletedEvent += Server_OnSendCompletedEvent;

            _server.Start();

            Console.WriteLine("Start server ...");

            while (true)
            {
                string val = Console.ReadLine();

                if (val == "exit")
                {
                    _server.Close();

                    break;
                }

                _server.SendAll(Encoding.UTF8.GetBytes(val));
            }
        }
Exemplo n.º 2
0
 public new static void Stop()
 {
     Log.Info("Service OnStop called: Shutting Down");
     Log.Info("Attempting to obtain lock on monitor");
     lock (MonitorObject)
     {
         Log.Info("lock obtained");
         _keepAliveScheduler.Stop();
         _subScriptionsReceiver.Stop();
         _socketServer.Close();
         Monitor.Pulse(MonitorObject);
     }
 }
Exemplo n.º 3
0
 private void OnDestroy()
 {
     mSocketServer.Close();
     mSocketServer = null;
 }
 protected override void OnDestroy()
 {
     mSocketServer.Close();
     mSocketServer = null;
 }
Exemplo n.º 5
0
 private void OnDestroy()
 {
     _server.Close();
     _server = null;
 }