Exemple #1
0
        public NetClientService(NetServerService netServerService, TcpClient tcpClient)
            : base(tcpClient)
        {
            ClientId  = (int)tcpClient.Client.Handle;
            Client.Id = (int)ClientId;
            EndPoint clientEndpoint = tcpClient.Client.RemoteEndPoint;

            if (clientEndpoint.GetType() == typeof(IPEndPoint))
            {
                IPEndPoint ipEndpoint = (IPEndPoint)clientEndpoint;
                Client.RemoteIpAddress = ipEndpoint.Address.ToString();
                Client.RemotePort      = ipEndpoint.Port;
            }

            _server = netServerService;
        }