private void timer1_Tick(object sender, EventArgs e) { EndPoint iep = new IPEndPoint(IPAddress.Any, 0); Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 11000); listener.Bind(localEndPoint); EndPoint ep = (EndPoint)iep; this.Text = "Ready to receive…"; byte[] data = new byte[1024]; int recv = listener.ReceiveFrom(data, ref ep); string stringData = Encoding.ASCII.GetString(data, 0, recv); listBox1.Items.Add(stringData); listener.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)