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); }
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(); } }
private void AddNewServerInfo(ServerUdpAnswerMessages serverUdpAnswerMessage) { serversInfo.Add(new ServerInfo(serverUdpAnswerMessage.ServerName, serverUdpAnswerMessage.SenderIp, serverUdpAnswerMessage.SenderPort)); }