private void Form1_Load(object sender, EventArgs e) { Thread thdUDPServer = new Thread(new ThreadStart(serverThread)); thdUDPServer.Start(); } public void serverThread() { UdpClient udpClient = new UdpClient(8080); while(true) { IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0); Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint); string returnData = Encoding.ASCII.GetString(receiveBytes); lbConnections.Items.Add( RemoteIpEndPoint.Address.ToString() + ":" + returnData.ToString() ); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)