code: public void setInterface(InetAddress inf) throws SocketException {
          if (isClosed()) {
              throw new SocketException("Socket is closed");
          }
          checkAddress(inf, "setInterface");
          synchronized (infLock) {
              getImpl().setOption(SocketOptions.IP_MULTICAST_IF, inf);
              infAddress = inf;
              interfaceSet = true;
          }
      }
docs: Set the multicast network interface used by methods
  whose behavior would be affected by the value of the
  network interface. Useful for multihomed hosts.
  @param inf the InetAddress
  @exception SocketException if there is an error in
  the underlying protocol, such as a TCP error.
  @see #getInterface()