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); }
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); }