//incoming connection constructor internal NetPeer(NetManager netManager, IPEndPoint remoteEndPoint) { Statistics = new NetStatistics(); _packetPool = netManager.NetPacketPool; _netManager = netManager; _remoteEndPoint = remoteEndPoint; _connectionState = ConnectionState.Incoming; _mergeData = new NetPacket(PacketProperty.Merged, NetConstants.MaxPacketSize); _pongPacket = new NetPacket(PacketProperty.Pong, 0); _pingPacket = new NetPacket(PacketProperty.Ping, 0); }
/// <summary> /// NetManager constructor /// </summary> /// <param name="listener">Network events listener</param> public NetManager(INetEventListener listener) { _socket = new NetSocket(ReceiveLogic); _netEventListener = listener; _netEventsQueue = new Queue <NetEvent>(); _netEventsPool = new Stack <NetEvent>(); NetPacketPool = new NetPacketPool(); NatPunchModule = new NatPunchModule(_socket); Statistics = new NetStatistics(); _peers = new NetPeerCollection(); _connectedPeerListCache = new List <NetPeer>(); }