Ejemplo n.º 1
0
 private void Connect()
 {
     client = ThreadListener.AcceptTcpClient();
     stream = client.GetStream();
     connections++;
     Console.WriteLine("New client accepted: {0} active connections", connections.ToString());
 }
Ejemplo n.º 2
0
        private void Connect()
        {
            Client = ThreadListener.AcceptTcpClient();
            Client.ReceiveTimeout = 60000; // 60 секунд таймаут получения
            Client.SendTimeout    = 30000; // 30 секунд таймаут отправки

            Stream = Client.GetStream();
            _Connections++;

            Log.Information("Принято новое соединение от {clientip}. Активно: {ActiveConnections}", Client.Client.RemoteEndPoint.ToString(), _Connections);
        }
Ejemplo n.º 3
0
 public void AddNode(Object node, HashTree subTree)
 {
     if (node is ThreadListener)
     {
         ThreadListener tl = (ThreadListener)node;
         if (isStart)
         {
             tl.threadStarted();
         }
         else
         {
             tl.threadFinished();
         }
     }
 }
Ejemplo n.º 4
0
        //[Test]
        public void MainServiceListenerAndClient()
        {
            ThreadClient   client   = new ThreadClient();
            ThreadListener listener = new ThreadListener();

            // start the listener & wait until it has started
            (new Thread(new ThreadStart(listener.Run))).Start();
            commonLock.WaitUntilEq(LISTENER_STARTED, 4000);

            // start the client
            (new Thread(new ThreadStart(client.Run))).Start();
            commonLock.WaitUntilEq(CLIENT_STARTED, 4000);

            Console.WriteLine("am i coming here?");

            if (client.HasErrors() || listener.HasErrors())
            {
                Assert.Fail();
            }
        }
 public ThreadManager(ThreadListener listener)
 {
     //assign the listener for our thread to call back to
     this.listener = listener;
 }
Ejemplo n.º 6
0
 public ThreadManager(ThreadListener listener)
 {
     this.listener = listener;
 }