예제 #1
0
 public LightController(CustomTcpClient client)
     : base()
 {
     this.sender             = client;
     this.id                 = GetLightIdFromIpAddr(client.Ip);
     this.sender.OnReceived += ClientOnReceived;
     State = LightState.OFF;
 }
예제 #2
0
 void server_ClientAccepted(object sender, TcpServerClientEventArgs <TcpAsyncClient> e)
 {
     this.client             = new CustomTcpClient(e.Client);
     this.client.OnReceived += client_Received;
     e.Client.Disconnected  += Client_Disconnected;
     Ip     = ((IPEndPoint)(e.Client.RemoteEndPoint)).Address.MapToIPv4().ToString();
     Status = DeviceState.已连接.ToString();
     NLog.LogManager.GetCurrentClassLogger().Info("Channel Client Connected:" + e.Client.RemoteEndPoint.ToString());
 }