Exemple #1
0
        void ListenThread()
        {
            ProsicsServer instance = this;

            try
            {
                while (true)
                {
                    Socket client = _serverSocket.Accept();
                    //client.IOControl(IOControlCode.KeepAliveValues,NetWorkHelper.GetKeppAlive(),null);
                    ConnectionThread ct = new ConnectionThread(client);
                    Logger.Log("#### new connection :" + client.RemoteEndPoint.ToString());
                    lock (_connections)
                    {
                        _connections.Add(ct);
                    }
                    ct.eventThreadWillTerminate = OnConnectionWillTerminate;
                    ct.eventReceiveData         = OnReceiveData;
                    ct.Start();
                }
            }
            catch (System.Exception e)
            {
                Logger.Log(e.ToString());
                _isRunning = false;
            }
            finally
            {
                Stop();
                NetWorkHelper.SafeClose(_serverSocket);
                Logger.Log("Server is Terminated.");
            }
        }
Exemple #2
0
 public ServerProxy()
 {
     _server = new ProsicsServer();
     _server.eventReceiveMsg = OnReceiveNetMessage;
 }