Is an IP address a broadcast address?

A

AbraKadabra

IP broadcast address usually have a .255 suffix, but not always.
Subnets sometimes use a different broadcast address (in fact, any IP
with trailing (binary) ones is a valid broadcast address).

The question is, does Java give you the means to know whether an IP
address is a broadcast address?

Thanks for any help,
AbraKadabra
 
J

jessu

Have you tried the method of the InetAddress class, especially the one
isMulticastAddress() ?
 
G

Gordon Beaton

Have you tried the method of the InetAddress class, especially the
one isMulticastAddress() ?

Multicast addresses and broadcast addresses aren't the same thing.

To determine the broadcast address, you need to know an ip address or
network address, as well as the corresponding network mask. AFAIK Java
doesn't provide mechanisms for obtaining the latter two, but the OP
could use Runtime.exec() and parse the output of e.g. ifconfig (or
ipconfig on windows).

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top