示例#1
0
 private void UDPMessageReceived(object sender, UDPNetworking.MessageRecievedEventArgs e)
 {
     if (e.message == "connectionrequest")
     {
         uDPNetworking.UDPSend(e.ipAddress, 14999, "connectionaccepted" + "_" + NetworkUtil.GetMachineName());
     }
 }
示例#2
0
        private void UDPMessageReceived(object sender, UDPNetworking.MessageRecievedEventArgs e)
        {
            if (e.message.Contains("connectionaccepted"))
            {
                string[] messages = e.message.Split('_');

                servername = messages[1];
                serverip   = e.ipAddress;

                Console.Out.WriteLine("[Client] ServerFound!");
                Console.Out.WriteLine("[Client] Setting IPAddress: " + e.ipAddress + " as Server Address");
                Console.Out.WriteLine("[Client] Name of the server is: " + servername);

                ServerFound(this, new EventArgs());
            }
        }