org.apache.commons.net

Class DefaultSocketFactory

public class DefaultSocketFactory extends SocketFactory

DefaultSocketFactory implements the SocketFactory interface by simply wrapping the java.net.Socket and java.net.ServerSocket constructors. It is the default SocketFactory used by SocketClient implementations.

Author: Daniel F. Savarese

See Also: SocketFactory SocketClient SocketClient

Method Summary
ServerSocketcreateServerSocket(int port)
Creates a ServerSocket bound to a specified port.
ServerSocketcreateServerSocket(int port, int backlog)
Creates a ServerSocket bound to a specified port with a given maximum queue length for incoming connections.
ServerSocketcreateServerSocket(int port, int backlog, InetAddress bindAddr)
Creates a ServerSocket bound to a specified port on a given local address with a given maximum queue length for incoming connections.

Method Detail

createServerSocket

public ServerSocket createServerSocket(int port)
Creates a ServerSocket bound to a specified port. A port of 0 will create the ServerSocket on a system-determined free port.

Parameters: port The port on which to listen, or 0 to use any free port.

Returns: A ServerSocket that will listen on a specified port.

Throws: IOException If an I/O error occurs while creating the ServerSocket.

createServerSocket

public ServerSocket createServerSocket(int port, int backlog)
Creates a ServerSocket bound to a specified port with a given maximum queue length for incoming connections. A port of 0 will create the ServerSocket on a system-determined free port.

Parameters: port The port on which to listen, or 0 to use any free port. backlog The maximum length of the queue for incoming connections.

Returns: A ServerSocket that will listen on a specified port.

Throws: IOException If an I/O error occurs while creating the ServerSocket.

createServerSocket

public ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddr)
Creates a ServerSocket bound to a specified port on a given local address with a given maximum queue length for incoming connections. A port of 0 will create the ServerSocket on a system-determined free port.

Parameters: port The port on which to listen, or 0 to use any free port. backlog The maximum length of the queue for incoming connections. bindAddr The local address to which the ServerSocket should bind.

Returns: A ServerSocket that will listen on a specified port.

Throws: IOException If an I/O error occurs while creating the ServerSocket.