Exemplo n.º 1
0
 internal Client(int id, TcpClient tcpClient, Action <Client> disconnected, Mutex mutex, Connection <MonoBrick.NXT.Command, MonoBrick.NXT.Reply> NXT, QueueThread <string> logQueue, BrickType type)
 {
     this.mutex                 = mutex;
     this.Brick                 = NXT;
     this.type                  = type;
     this.logQueue              = logQueue;
     address                    = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address;
     connectTime                = DateTime.Now;
     tcpClient.NoDelay          = true;
     networkStream              = tcpClient.GetStream();
     networkStream.ReadTimeout  = Timeout.Infinite;
     networkStream.WriteTimeout = 1000;
     onDisconnected             = disconnected;
     this.ID                    = id;
     LogId            = true;
     this.LogActivity = true;
     logQueue.AddToQueue("Client created");
 }
Exemplo n.º 2
0
 public void ThrowOff()
 {
     logQueue.AddToQueue("Client " + ID + ": Throw off signaled");
     wasThrownOff = true;
     if (IsConnected)
     {
         networkStream.Close();
     }
 }
Exemplo n.º 3
0
 public void Write(string message)
 {
     queue.AddToQueue(DateTime.Now.ToString() + ": " + message);
 }