To listen on a UDP port, you must bind a port. Here is the C # code I'm using. It uses a receive stream that polls the socket for messages.
Socket soUdp_msg = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,ProtocolType.Udp); IPEndPoint localIpEndPoint_msg = new IPEndPoint(IPAddress.Any, UdpPort_msg); soUdp_msg.Bind(localIpEndPoint_msg);
Then in my receive stream
byte[] received_s = new byte[2048]; IPEndPoint tmpIpEndPoint = new IPEndPoint(IPAddress.Any, UdpPort_msg); EndPoint remoteEP = (tmpIpEndPoint); while (soUdp_msg.Poll(0, SelectMode.SelectRead)) { int sz = soUdp_msg.ReceiveFrom(received_s, ref remoteEP); tep = (IPEndPoint)remoteEP;
source share