p2ps.imp.net.inet
Class InetNetworkInterface
java.lang.Object
p2ps.imp.net.inet.InetNetworkInterface
- All Implemented Interfaces:
- NetworkInterface
- public class InetNetworkInterface
- extends java.lang.Object
- implements NetworkInterface
An interface to the Internet. This is the default network binding.
- Version:
- $Revision: 295 $
- Author:
- Ian Wang
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DISCOVERY_ADDR
public static java.lang.String DISCOVERY_ADDR
DISCOVERY_PORT
public static int DISCOVERY_PORT
InetNetworkInterface
public InetNetworkInterface()
getLocalHostAddress
public java.lang.String getLocalHostAddress()
throws java.net.UnknownHostException
- Specified by:
getLocalHostAddress in interface NetworkInterface
- Returns:
- the address of the local host as a String
- Throws:
java.net.UnknownHostException
getNetworkInterface
public java.net.NetworkInterface getNetworkInterface(java.net.SocketAddress addr)
throws java.net.SocketException
- Specified by:
getNetworkInterface in interface NetworkInterface
- Returns:
- the java.net network interface that owns the specified socket
address. In non-java.net interfaces this method can probably return null.
- Throws:
java.net.SocketException
createSocketAddress
public java.net.SocketAddress createSocketAddress(java.lang.String addr,
int port)
- Specified by:
createSocketAddress in interface NetworkInterface
- Returns:
- a new socket address
createGroupAddress
public java.net.SocketAddress createGroupAddress(int port)
- Specified by:
createGroupAddress in interface NetworkInterface
- Returns:
- a group address with the specified port
createDiscoveryAddress
public java.net.SocketAddress createDiscoveryAddress()
- Specified by:
createDiscoveryAddress in interface NetworkInterface
- Returns:
- the discovery group address
getHostAddress
public java.lang.String getHostAddress(java.net.SocketAddress address)
- Specified by:
getHostAddress in interface NetworkInterface
- Returns:
- the host address from a socket address
getPort
public int getPort(java.net.SocketAddress address)
- Specified by:
getPort in interface NetworkInterface
- Returns:
- the port from a socket address
createServerSocket
public ServerSocket createServerSocket(java.net.SocketAddress addr,
java.lang.String type,
java.util.Map properties)
throws java.io.IOException
- Specified by:
createServerSocket in interface NetworkInterface
- Parameters:
addr - type - the type of server socketproperties - properties of the server socket
- Returns:
- a server socket bound to the specified port
- Throws:
java.io.IOException
createSocket
public Socket createSocket(java.net.SocketAddress addr,
java.lang.String type,
java.util.Map properties)
throws java.io.IOException
- Specified by:
createSocket in interface NetworkInterface
- Parameters:
addr - type - the type of socket instanceproperties - properties of the socket instance
- Returns:
- a socket instance
- Throws:
java.io.IOException
createDatagramSocket
public DatagramSocket createDatagramSocket(java.net.SocketAddress addr,
java.lang.String type,
java.util.Map properties)
throws java.io.IOException
- Specified by:
createDatagramSocket in interface NetworkInterface
- Parameters:
addr - type - the type of datagram socket instanceproperties - properties of the datagram socket instance
- Returns:
- a datagram socket instance
- Throws:
java.io.IOException
createMulticastSocket
public MulticastSocket createMulticastSocket(java.net.SocketAddress addr,
java.lang.String type,
java.util.Map properties)
throws java.io.IOException
- Specified by:
createMulticastSocket in interface NetworkInterface
- Parameters:
addr - type - the type of multicast socket instanceproperties - properties of the multicast socket instance
- Returns:
- a multicast socket instance
- Throws:
java.io.IOException