This constructor is used to create an instance of the object
multiaddr = addr;
if (null != netInterface) {
// TODO check if necessary
//interfaceIdx = netInterface.getIndex();
/*
* here we need to get the first IPV4 address as we only use it if
* we are setting the interface for an IPV4 multicast socket. For
* adds/drops on IPV6 addresses we use the index within the
* networkInterface
*/
interfaceAddr = null;
Enumeration<InetAddress> theAddresses = netInterface.getInetAddresses();
if ((addr instanceof Inet4Address) && (theAddresses != null)) {
boolean found = false;
while ((theAddresses.hasMoreElements()) && (found != true)) {
InetAddress theAddress = theAddresses.nextElement();
if (theAddress instanceof Inet4Address) {
interfaceAddr = theAddress;
found = true;
}
}
}
} else {
/*
* network interface is null so we just want to defer the decision
* to the system
*/
interfaceIdx = 0;
interfaceAddr = null;
}
init();