コード例 #1
0
        public TestClientPeer(IShamanLogger logger, ITaskSchedulerFactory taskSchedulerFactory, ISerializer serializer)
        {
            _logger        = logger;
            _serializer    = serializer;
            _taskScheduler = taskSchedulerFactory.GetTaskScheduler();
            _clientPeer    = new ClientPeer(logger, taskSchedulerFactory, 300, 10);
            //_clientPeer.OnPackageReceived += ClientOnPackageReceived;

            _clientPeer.OnDisconnectedFromServer = OnDisconnected;

            _taskScheduler.ScheduleOnInterval(() =>
            {
                IPacketInfo pack = null;
                while ((pack = _clientPeer.PopNextPacket()) != null)
                {
                    ClientOnPackageReceived(pack);
                }
            }, 0, 10);
        }