Schnittstelle NetworkAddressFactory

Alle bekannten Implementierungsklassen:
NetworkAddressFactoryImpl

public interface NetworkAddressFactory
Configuration utility for network interfaces and addresses.

An implementation has to be thread-safe.

Autor:
Christian Bauer, Kai Kreuzer - added multicast response port
  • Felddetails

  • Methodendetails

    • getMulticastGroup

      InetAddress getMulticastGroup()
      Gibt zurück:
      The UDP multicast group to join.
    • getMulticastPort

      int getMulticastPort()
      Gibt zurück:
      The UDP multicast port to listen on.
    • getMulticastResponsePort

      int getMulticastResponsePort()
      Gibt zurück:
      The UDP port to listen on for search responses.
    • getStreamListenPort

      int getStreamListenPort()
      Gibt zurück:
      The TCP (HTTP) stream request port to listen on.
    • getNetworkInterfaces

      Iterator<NetworkInterface> getNetworkInterfaces()
      The caller might remove() an interface if initialization fails.
      Gibt zurück:
      The local network interfaces on which multicast groups will be joined.
    • getBindAddresses

      Iterator<InetAddress> getBindAddresses()
      The caller might remove() an address if initialization fails.
      Gibt zurück:
      The local addresses of the network interfaces bound to sockets listening for unicast datagrams and TCP requests.
    • hasUsableNetwork

      boolean hasUsableNetwork()
      Gibt zurück:
      true if there is at least one usable network interface and bind address.
    • getAddressNetworkPrefixLength

      Short getAddressNetworkPrefixLength(InetAddress inetAddress)
      Gibt zurück:
      The network prefix length of this address or null.
    • getHardwareAddress

      byte[] getHardwareAddress(InetAddress inetAddress)
      Parameter:
      inetAddress - An address of a local network interface.
      Gibt zurück:
      The MAC hardware address of the network interface or null if no hardware address could be obtained.
    • getBroadcastAddress

      InetAddress getBroadcastAddress(InetAddress inetAddress)
      Parameter:
      inetAddress - An address of a local network interface.
      Gibt zurück:
      The broadcast address of the network (interface) or null if no broadcast address could be obtained.
    • getLocalAddress

      InetAddress getLocalAddress(NetworkInterface networkInterface, boolean isIPv6, InetAddress remoteAddress) throws IllegalStateException
      Best-effort attempt finding a reachable local address for a given remote host.

      This method is called whenever a multicast datagram has been received. We need to be able to communicate with the sender using UDP unicast and we need to tell the sender how we are reachable with TCP requests. We need a local address that is in the same subnet as the senders address, that is reachable from the senders point of view.

      Parameter:
      networkInterface - The network interface to examine.
      isIPv6 - True if the given remote address is an IPv6 address.
      remoteAddress - The remote address for which to find a local address in the same subnet.
      Gibt zurück:
      A local address that is reachable from the given remote address.
      Löst aus:
      IllegalStateException - If no local address reachable by the remote address has been found.
    • logInterfaceInformation

      void logInterfaceInformation()
      For debugging, logs all "usable" network interface(s) details with INFO level.