public JdpBroadcaster(InetAddress address,InetAddress srcAddress,int port,int ttl) throws IOException, JdpException {
  this.addr=address;
  this.port=port;
  ProtocolFamily family=(address instanceof Inet6Address) ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
  channel=DatagramChannel.open(family);
  channel.setOption(StandardSocketOptions.SO_REUSEADDR,true);
  channel.setOption(StandardSocketOptions.IP_MULTICAST_TTL,ttl);
  if (srcAddress != null) {
    NetworkInterface interf=NetworkInterface.getByInetAddress(srcAddress);
    try {
      channel.bind(new InetSocketAddress(srcAddress,0));
    }
 catch (    UnsupportedAddressTypeException ex) {
      throw new JdpException("Unable to bind to source address");
    }
    channel.setOption(StandardSocketOptions.IP_MULTICAST_IF,interf);
  }
}

public JdpBroadcaster ( InetAddress address , InetAddress srcAddress , int port , int ttl ) throws IOException , JdpException { this . addr = address ; this . port = port ; ProtocolFamily family = ( address instanceof Inet6Address ) ? StandardProtocolFamily . INET6 : StandardProtocolFamily . INET ; channel = DatagramChannel . open ( family ) ; channel . setOption ( StandardSocketOptions . SO_REUSEADDR , true ) ; channel . setOption ( StandardSocketOptions . IP_MULTICAST_TTL , ttl ) ; if ( srcAddress != null ) { NetworkInterface interf = NetworkInterface . getByInetAddress ( srcAddress ) ; try { channel . bind ( new InetSocketAddress ( srcAddress , 0 ) ) ; } catch ( UnsupportedAddressTypeException ex ) { throw new JdpException ( "Unable to bind to source address" ) ; } channel . setOption ( StandardSocketOptions . IP_MULTICAST_IF , interf ) ; } }
create a new broadcaster
