示例#1
0
        private void HandleClientUdpRequestMessage(ClientUdpRequestMessages clientUdpRequestMessage)
        {
            ServerUdpAnswerMessages serverUdpAnswerMessage = GetServerUdpAnswerMessage();
            IPEndPoint clientEndPoint        = new IPEndPoint(clientUdpRequestMessage.SenderIp, clientUdpRequestMessage.SenderPort);
            Socket     serverUdpAnswerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

            serverUdpAnswerSocket.SendTo(messageSerializer.Serialize(serverUdpAnswerMessage), clientEndPoint);
        }
示例#2
0
        public void AddServerInfoToServersListBox(ServerUdpAnswerMessages serverUdpAnswerMessage)
        {
            Action action = delegate
            {
                string serverInfo = serverUdpAnswerMessage.ServerName + " port: " + serverUdpAnswerMessage.SenderPort + " ip: " + serverUdpAnswerMessage.SenderIp;
                serversListBox.Items.Add(serverInfo);
            };

            if (InvokeRequired)
            {
                Invoke(action);
            }
            else
            {
                action();
            }
        }
示例#3
0
 private void AddNewServerInfo(ServerUdpAnswerMessages serverUdpAnswerMessage)
 {
     serversInfo.Add(new ServerInfo(serverUdpAnswerMessage.ServerName, serverUdpAnswerMessage.SenderIp, serverUdpAnswerMessage.SenderPort));
 }