Directed Broadcast Address

Hi Guys,

I need to send some UDP packets to the directed broadcast address (broadcast address of a subnet). Does anyone know how to find the directed broadcast address for each network interface using any of the JUCE classes? Are there any ways of finding out connection details for the network interfaces in JUCE?

For instance on my home network:

Adaptor IP = 192.168.0.27
Network address = 192.168.0.0
Subnet Mask = 255.255.255.0
Broadcast Address = 192.168.0.255

Depending on the network connection the directed broadcast address will be different. I am not much of a network expert so any thoughts on this would be much appreciated!

Cheers,

Chris

This is a super simple tutorial: http://www.connected-dots-networking.com/learn?lesson=calculating7

Yes, however I think that to calculate the broadcast address, you still need to know the network address and the subnet mask. How can I find this information for a network connection? Can this be done in JUCE?

I noticed that void IPAddress::findAllAddresses() returns the IP address for each network interface. Would it be possible to add a function that also includes the netmask?

For instance:
void IPAddress::findAllAddressesAndNetmasks (Array<IPAddress>& addresses, Array<IPAddress>& netmasks, bool includeIPv6);

Alternatively, there could be a method that returns an array of NetworkAdaptorInfo objects containing useful info about the network adaptors.

With the netmask, I could work out the network and directed broadcast address for each interface.

Is there anything like this that exists already in JUCE? Could something like this be added?

Chris