public void StopServer()
 {
     if (tcpListener != null) {
         tcpListener.Stop();
         tcpListener = null;
     }
 }
Beispiel #2
0
 public void StopServer()
 {
     if (tcpListener != null)
     {
         tcpListener.Stop();
         tcpListener = null;
     }
 }
 public void StartServer(int port)
 {
     Port = port;
     if (tcpListener != null) {
         tcpListener.Stop();
         tcpListener = null;
     }
     tcpListener = new TcpListenerActive(IPAddress.Any, port);
     tcpListener.Start();
     tcpListener.BeginAcceptTcpClient(HandleAsyncConnection, tcpListener);
 }
Beispiel #4
0
 public void StartServer(int port)
 {
     Port = port;
     if (tcpListener != null)
     {
         tcpListener.Stop();
         tcpListener = null;
     }
     tcpListener = new TcpListenerActive(IPAddress.Any, port);
     tcpListener.Start();
     tcpListener.BeginAcceptTcpClient(HandleAsyncConnection, tcpListener);
 }
Beispiel #5
0
        protected void HandleAsyncConnection(IAsyncResult result)
        {
            TcpClient client;

            try {
                TcpListenerActive listener = (TcpListenerActive)result.AsyncState;
                client = listener.EndAcceptTcpClient(result);
                connectionWaitDone.Set();
                tcpListener.BeginAcceptTcpClient(HandleAsyncConnection, listener);

                Connection clientConnection = new Connection(client);
                clientConnection.StartLogin();
            } catch (Exception e) {
                string msg = e.Message;
            }
        }