Package org.jupnp.transport.spi
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
-
Feldübersicht
Felder -
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetAddressNetworkPrefixLength(InetAddress inetAddress) The caller mightremove()an address if initialization fails.getBroadcastAddress(InetAddress inetAddress) byte[]getHardwareAddress(InetAddress inetAddress) getLocalAddress(NetworkInterface networkInterface, boolean isIPv6, InetAddress remoteAddress) Best-effort attempt finding a reachable local address for a given remote host.intintThe caller mightremove()an interface if initialization fails.intbooleanvoidFor debugging, logs all "usable" network interface(s) details with INFO level.
-
Felddetails
-
SYSTEM_PROPERTY_NET_IFACES
- Siehe auch:
-
SYSTEM_PROPERTY_NET_ADDRESSES
- Siehe auch:
-
-
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 mightremove()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 mightremove()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:
trueif there is at least one usable network interface and bind address.
-
getAddressNetworkPrefixLength
- Gibt zurück:
- The network prefix length of this address or
null.
-
getHardwareAddress
- Parameter:
inetAddress- An address of a local network interface.- Gibt zurück:
- The MAC hardware address of the network interface or
nullif no hardware address could be obtained.
-
getBroadcastAddress
- Parameter:
inetAddress- An address of a local network interface.- Gibt zurück:
- The broadcast address of the network (interface) or
nullif 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.
-