UdpClient udpClient = new UdpClient(8080);
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()); } } public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Thread thdUDPServer = new Thread(new ThreadStart(serverThread)); thdUDPServer.Start(); }
UDPClient
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)