public RemoteConTcpClient(TcpClient tcp, RemoteConServer remoteConServer) { _tcp = tcp; _remoteConServer = remoteConServer; _ns = tcp.GetStream(); _connected = true; Authenticated = false; try { // Connection was closed. if (!_tcp.Connected) { return; } // As indicated by specification the maximum packet size is 4096 // NOTE: Not sure if only the server is allowed to sent packets with max 4096 or both parties! _buffer = new byte[MAX_ALLOWED_PACKET_SIZE]; _ns.BeginRead(_buffer, 0, MAX_ALLOWED_PACKET_SIZE, OnPacket, null); } catch (Exception ex) { Console.WriteLine(ex); } }
/// <summary> /// UnitTest only constructor /// </summary> internal RemoteConTcpClient(RemoteConServer remoteConServer) { _remoteConServer = remoteConServer; _isUnitTest = true; }