Ejemplo n.º 1
0
Archivo: Client.cs Proyecto: Wroud/Coob
        public Client(TcpClient tcpClient)
        {
            Joined = false;
            Entity = null;

            tcp = tcpClient;
            IP = (tcp.Client.RemoteEndPoint as IPEndPoint).Address.ToString();
            NetStream = tcp.GetStream();
            Reader = new NetReader(NetStream);
            Writer = new BinaryWriter(NetStream);

            ID = Root.Coob.CreateID();

            if (ID == 0)
                throw new UserLimitReachedException();

            recvBuffer = new byte[4];
            NetStream.BeginRead(recvBuffer, 0, 4, idCallback, null);
        }
Ejemplo n.º 2
0
        public Client(TcpClient tcpClient, Coob coob)
        {
            Joined        = false;
            Entity        = null;
            disconnecting = false;
            tcp           = tcpClient;
            Ip            = ((IPEndPoint)tcp.Client.RemoteEndPoint).Address.ToString();
            NetStream     = tcp.GetStream();
            Reader        = new NetReader(NetStream);
            Writer        = new BinaryWriter(NetStream);
            Coob          = coob;

            Id = Coob.CreateId();

            if (Id == 0)
            {
                throw new UserLimitReachedException();
            }

            recvBuffer = new byte[4];
            NetStream.BeginRead(recvBuffer, 0, 4, IdCallback, null);
        }