Пример #1
0
        internal RaknetHandler(RaknetConnection connection, ConnectionInfo connectionInfo)
        {
            _connection     = connection;
            _connectionInfo = connectionInfo;

            byte[] buffer = new byte[8];
            new Random().NextBytes(buffer);
            ClientGuid = BitConverter.ToInt64(buffer, 0);
        }
Пример #2
0
        public RaknetSession(API.Network.ConnectionInfo connectionInfo, RaknetConnection packetSender, IPEndPoint endPoint, short mtuSize, ICustomMessageHandler messageHandler = null)
        {
            _packetSender        = packetSender;
            ConnectionInfo       = connectionInfo;
            CustomMessageHandler = messageHandler ?? new DefaultMessageHandler();
            EndPoint             = endPoint;
            MtuSize = mtuSize;

            InactivityTimeout = 30000;
            ResendThreshold   = 10;

            _cancellationToken = new CancellationTokenSource();
        }
Пример #3
0
        public RaknetSession(ConnectionInfo connectionInfo, RaknetConnection packetSender, IPEndPoint endPoint, short mtuSize, ICustomMessageHandler messageHandler = null)
        {
            Log.Debug($"Create session for {endPoint}");

            _packetSender        = packetSender;
            ConnectionInfo       = connectionInfo;
            CustomMessageHandler = messageHandler ?? new DefaultMessageHandler();
            EndPoint             = endPoint;
            MtuSize = mtuSize;

            InactivityTimeout = 8500;        //Config.GetProperty("InactivityTimeout", 8500);
            ResendThreshold   = 10;          //Config.GetProperty("ResendThreshold", 10);

            _cancellationToken = new CancellationTokenSource();
            //_tickerHighPrecisionTimer = new HighPrecisionTimer(10, SendTick, true);
        }