org.fourthline.cling.android
Class AndroidNetworkAddressFactory
java.lang.Object
org.fourthline.cling.transport.impl.NetworkAddressFactoryImpl
org.fourthline.cling.android.AndroidNetworkAddressFactory
- All Implemented Interfaces:
- NetworkAddressFactory
public class AndroidNetworkAddressFactory
- extends NetworkAddressFactoryImpl
This factory tries to work around and patch some Android bugs.
- Author:
- Michael Pujos, Christian Bauer
Methods inherited from class org.fourthline.cling.transport.impl.NetworkAddressFactoryImpl |
discoverBindAddresses, getAddressNetworkPrefixLength, getBindAddresses, getBindAddressInSubnetOf, getBroadcastAddress, getHardwareAddress, getInetAddresses, getInterfaceAddresses, getMulticastGroup, getMulticastPort, getNetworkInterfaces, getStreamListenPort, hasUsableNetwork, isInSubnet, isUsableNetworkInterface, logInterfaceInformation, logInterfaceInformation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AndroidNetworkAddressFactory
public AndroidNetworkAddressFactory(int streamListenPort)
requiresNetworkInterface
protected boolean requiresNetworkInterface()
- Overrides:
requiresNetworkInterface
in class NetworkAddressFactoryImpl
- Returns:
true
(the default) if a MissingNetworkInterfaceException
should be thrown
isUsableAddress
protected boolean isUsableAddress(NetworkInterface networkInterface,
InetAddress address)
- Description copied from class:
NetworkAddressFactoryImpl
- Validation of every discovered local address.
Override this method to customize which network addresses are used.
The given implementation ignores addresses which are
- not IPv4
- the local loopback (yes, we ignore 127.0.0.1)
- Overrides:
isUsableAddress
in class NetworkAddressFactoryImpl
- Parameters:
networkInterface
- The interface to validate.address
- The address of this interface to validate.
- Returns:
- True if the given address matches all validation criteria.
getLocalAddress
public InetAddress getLocalAddress(NetworkInterface networkInterface,
boolean isIPv6,
InetAddress remoteAddress)
- Description copied from interface:
NetworkAddressFactory
- 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.
- Specified by:
getLocalAddress
in interface NetworkAddressFactory
- Overrides:
getLocalAddress
in class NetworkAddressFactoryImpl
- Parameters:
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.
- Returns:
- A local address that is reachable from the given remote address.
discoverNetworkInterfaces
protected void discoverNetworkInterfaces()
throws InitializationException
- Overrides:
discoverNetworkInterfaces
in class NetworkAddressFactoryImpl
- Throws:
InitializationException
Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.