Beispiel #1
0
        public void SendNatPunch(ReceivedMessage message)
        {
            var natPunchPayload = new UdpMessage("natpunchresponse")
            {
                Data = new NatPunchResponse
                {
                    PublicIpAddress = message.Result.RemoteEndPoint.Address.ToString(),
                    PublicPort      = message.Result.RemoteEndPoint.Port
                }
            };

            SendMessageToClient(natPunchPayload, message.Result.RemoteEndPoint);
        }
Beispiel #2
0
        void OnMessageReceived(UdpReceiveResult result)
        {
            var udpMessage      = ExtractUdpMessage(result);
            var receivedMessage = new ReceivedMessage(result, udpMessage);
            var matchedClient   = SmartGameServer._connectedClients.GetByIPEndpoint(receivedMessage.Result.RemoteEndPoint);

            if (matchedClient != null)
            {
                ProcessConectedClientMessage(new ReceivedClientMessage(receivedMessage, matchedClient));
            }
            else
            {
                ProcessUnkownClientMessage(receivedMessage);
            }
        }