org.objectweb.jonathan.protocols.ip.lib
Class IPv4ConnectionFactory
- TcpIpConnectionMgr
public class IPv4ConnectionFactory
Implementation of an IP V4 connection factory.
int | SO_LINGER - If >= 0, enables the SO_LINGER option with the specified linger time.
|
int | SO_TIMEOUT - If >= 0, enables the SO_TIMEOUT option with the specified timeout (in
ms).
|
boolean | TCP_NODELAY - If true, enables the TCP_NODELAY option.
|
int | backlog - Maximum length of the queue on incoming connect requests.
|
String | localhost_name
|
boolean | use_address_as_name - Indicates whether the names used to identify endpoints should be
host names or host addresses.
|
boolean | verbose - Indicates whether warning messages should be printed to stderr.
|
IPv4ConnectionFactory() - Returns a new IPv4ConnectionFactory with default parameters
|
IPv4ConnectionFactory(String localhost_value, boolean verbose, int SO_LINGER, int SO_TIMEOUT, boolean TCP_NODELAY, int backlog, int max_retries, boolean use_address_as_name) - Returns a new IPv4 connection factory
|
SO_LINGER
public int SO_LINGER
If >= 0, enables the SO_LINGER option with the specified linger time.
SO_TIMEOUT
public int SO_TIMEOUT
If >= 0, enables the SO_TIMEOUT option with the specified timeout (in
ms). 0 means infinity (no timeout).
TCP_NODELAY
public boolean TCP_NODELAY
If true, enables the TCP_NODELAY option.
backlog
public int backlog
Maximum length of the queue on incoming connect requests.
localhost_name
public String localhost_name
use_address_as_name
public boolean use_address_as_name
Indicates whether the names used to identify endpoints should be
host names or host addresses.
verbose
public boolean verbose
Indicates whether warning messages should be printed to stderr.
IPv4ConnectionFactory
public IPv4ConnectionFactory()
throws JonathanException
Returns a new IPv4ConnectionFactory with default parameters
IPv4ConnectionFactory
public IPv4ConnectionFactory(String localhost_value,
boolean verbose,
int SO_LINGER,
int SO_TIMEOUT,
boolean TCP_NODELAY,
int backlog,
int max_retries,
boolean use_address_as_name)
throws JonathanException
Returns a new IPv4 connection factory
localhost_value
- string representing the local machine (may be null)verbose
- indicates whether warning messages should be output on stderrSO_LINGER
- SO_LINGER parameter used to create socketsSO_TIMEOUT
- SO_TIMEOUT parameter used to create socketsTCP_NODELAY
- TCP_NODELAY parameter used to create socketsbacklog
- backlog parameter used to create socketsmax_retries
- maximum number of retries when creating a socketuse_address_as_name
- use a.b.c.d adresses instead of DNS names
getCanonicalHostName
public String getCanonicalHostName(String hostname)
Returns the canonical host name corresponding to hostname.
If use_address_as_name is true, the canonical host name is the
string corresponding to the IP address, else it is the machine name.
- getCanonicalHostName in interface TcpIpConnectionMgr
hostname
- a host name.
- the canonical host name corresponding to hostname.
newCltConnection
public IpConnection newCltConnection(String host,
int port,
IpSession session)
throws JonathanException
Builds a new client-side connection with the provided parameters.
- newCltConnection in interface TcpIpConnectionMgr
host
- a host name;port
- a port number;session
- a TCP/IP session;
- a new client-side connection.
newSrvConnection
protected org.objectweb.jonathan.protocols.ip.lib.IPv4ConnectionFactory.Connection newSrvConnection(Socket socket,
IpSession session,
String host,
int port)
throws JonathanException
Builds a new server-side connection with the provided parameters.
socket
- a TCP/IP socket;session
- a TCP/IP session;host
- a host name;port
- a port number;
- a new server-side connection.
newSrvConnectionFactory
public TcpIpSrvConnectionFactory newSrvConnectionFactory(int port)
throws JonathanException
Returns a new server connection factory encapsulating a server socket on the
provided port. If port = 0, an anonymous server socket is opened.
- newSrvConnectionFactory in interface TcpIpConnectionMgr
port
- the expected port of the server socket;
- a server connection factory.
setVerbose
public void setVerbose(boolean verbose)