Exemplo n.º 1
0
        public void SendOpenConnectionRequest1()
        {
            var packet = new OpenConnectionRequest1()
            {
                raknetProtocolVersion = 7, // Indicate to the server that this is a performance tests. Disables logging.
                mtuSize = _mtuSize
            };

            byte[] data = packet.Encode();

            TraceSend(packet);

            // 1087 1447
            byte[] data2 = new byte[_mtuSize - data.Length];
            Buffer.BlockCopy(data, 0, data2, 0, data.Length);

            SendData(data2);
        }
Exemplo n.º 2
0
		private void HandleRakNetMessage(IPEndPoint senderEndpoint, OpenConnectionRequest1 incoming)
		{
			lock (_playerSessions)
			{
				// Already connecting, then this is just a duplicate
				if (_connectionAttemps.ContainsKey(senderEndpoint))
				{
					DateTime created;
					_connectionAttemps.TryGetValue(senderEndpoint, out created);

					if (DateTime.UtcNow < created + TimeSpan.FromSeconds(3))
					{
						return;
					}

					_connectionAttemps.TryRemove(senderEndpoint, out created);
				}

				if (!_connectionAttemps.TryAdd(senderEndpoint, DateTime.UtcNow)) return;
			}

			if (Log.IsDebugEnabled)
				Log.WarnFormat("New connection from: {0} {1}, MTU: {2}", senderEndpoint.Address, senderEndpoint.Port, incoming.mtuSize);

			var packet = OpenConnectionReply1.CreateObject();
			packet.serverGuid = 12345;
			packet.mtuSize = incoming.mtuSize;
			packet.serverHasSecurity = 0;
			var data = packet.Encode();
			packet.PutPool();

			TraceSend(packet);

			SendData(data, senderEndpoint);
		}
Exemplo n.º 3
0
        public void SendOpenConnectionRequest1()
        {
            var packet = new OpenConnectionRequest1()
            {
                raknetProtocolVersion = byte.MaxValue, // Indicate to the server that this is a performance tests. Disables logging.
                mtuSize = _mtuSize
            };

            var data = packet.Encode();
            SendData(data);
        }