コード例 #1
0
        public NetClient(PacketManager packetManager)
        {
            _packetManager = packetManager;

            _tcpNetClient = new TcpNetClient();
            _udpNetClient = new UdpNetClient();

            _tcpNetClient.RegisterOnConnect(OnConnect);
            _tcpNetClient.RegisterOnConnectFailed(OnConnectFailed);

            // Register the same function for both TCP and UDP receive callbacks
            _udpNetClient.RegisterOnReceive(OnReceiveData);
        }
コード例 #2
0
        public UdpUpdateManager(UdpNetClient udpNetClient)
        {
            _udpNetClient = udpNetClient;

            _sentQueue      = new ConcurrentDictionary <ushort, Stopwatch>();
            _sequenceNumber = 0;

            // TODO: is this a good initial value?
            _averageRtt = 0f;
            _currentSwitchTimeThreshold = 10000;

            _currentUpdatePacket = new ServerUpdatePacket();

            _sendStopwatch              = new Stopwatch();
            _belowThresholdStopwatch    = new Stopwatch();
            _currentCongestionStopwatch = new Stopwatch();
        }
コード例 #3
0
 public ClientUpdateManager(UdpNetClient udpNetClient) : base(udpNetClient.UdpClient)
 {
 }