p2ps.imp.net
Interface NetworkInterface
- All Known Implementing Classes:
- InetNetworkInterface
- public interface NetworkInterface
An interface to the underlying network. Different implementations of this
interface allow different networks to be plugged in, rather than assuming
the Internet as Java does.
- Version:
- $Revision: 295 $
- Author:
- Ian Wang
DEFAULT_SOCKET_TYPE
public static final java.lang.String DEFAULT_SOCKET_TYPE
- See Also:
- Constant Field Values
SSL_SOCKET_TYPE
public static final java.lang.String SSL_SOCKET_TYPE
- See Also:
- Constant Field Values
getLocalHostAddress
public java.lang.String getLocalHostAddress()
throws java.net.UnknownHostException
- 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
- 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)
- Returns:
- a new socket address
createGroupAddress
public java.net.SocketAddress createGroupAddress(int port)
- Returns:
- a group address with the specified port
createDiscoveryAddress
public java.net.SocketAddress createDiscoveryAddress()
- Returns:
- the discovery group address
getHostAddress
public java.lang.String getHostAddress(java.net.SocketAddress address)
- Returns:
- the host address from a socket address
getPort
public int getPort(java.net.SocketAddress address)
- 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
- 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
- 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
- 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
- Parameters:
addr - type - the type of multicast socket instanceproperties - properties of the multicast socket instance
- Returns:
- a multicast socket instance
- Throws:
java.io.IOException