I have an application that sends broadcast messages and listens for response packets. Below is a snippet of code.
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); m_socket.Bind(new IPEndPoint(IPAddress.Any, 2000)); m_socket.BeginSendTo( buffer, 0, buffer.Length, SocketFlags.None, new IPEndPoint(IPAddress.Broadcast, 2000), Callback), null );
When I launch the application, no broadcast message was sent. I have three network adapters on my machine. One of them is my local network adapter, and the other two are VMWare virtual adapters. When I launch my application, I see (using wirehark network capture) that a broadcast message is being sent from one of VMWare's network adapters.
I would like to change the code so that the broadcast message is sent from all network adapters to the PC. What is the best way to do this?
sdasari
source share