Additional top-level class in compilation unit: DefaultSocketFactory.
Socket factories are a simple way to capture a variety of policies related to the sockets being constructed, producing such sockets in a way which does not require special configuration of the code which asks for the sockets:
Factory classes are specified by environment-specific configuration mechanisms. For example, the getDefault method could return a factory that was appropriate for a particular application, and a framework could use a factory customized to its own purposes.
ServerSocketFactory
| Modifier and Type | Field and Description |
|---|---|
| private static SocketFactory |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Socket | |
| public abstract Socket | Returns: theSocketthe server host name with which to connect, or
host, int null for the loopback address.the server port port)Creates a socket and connects it to the specified remote host at the specified remote port. |
| public abstract Socket | Returns: theSocketthe server host name with which to connect, or
host, int null for the loopback address.the server port port, InetAddress the local address the socket is bound to localHost, int the local port the socket is bound to localPort)Creates a socket and connects it to the specified remote host on the specified remote port. |
| public abstract Socket | Returns: theSocketthe server host host, int the server port port)Creates a socket and connects it to the specified port number at the specified address. |
| public abstract Socket | Returns: theSocketthe server network address address, int the server port port, InetAddress the client network address localAddress, int the client port localPort)Creates a socket and connect it to the specified remote address on the specified remote port. |
| public static SocketFactory | Returns: the defaultSocketFactoryReturns a copy of the environment's default socket factory. |
| theFactory | back to summary |
|---|---|
| private static SocketFactory theFactory | |
| SocketFactory | back to summary |
|---|---|
| protected SocketFactory() Creates a | |
| createSocket | back to summary |
|---|---|
| public Socket createSocket() throws IOException Creates an unconnected socket.
| |
| createSocket | back to summary |
|---|---|
| public abstract Socket createSocket(String host, int port) throws IOException, UnknownHostException Creates a socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory.
| |
| createSocket | back to summary |
|---|---|
| public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException Creates a socket and connects it to the specified remote host on the specified remote port. The socket will also be bound to the local address and port supplied. This socket is configured using the socket options established for this factory.
| |
| createSocket | back to summary |
|---|---|
| public abstract Socket createSocket(InetAddress host, int port) throws IOException Creates a socket and connects it to the specified port number at the specified address. This socket is configured using the socket options established for this factory.
| |
| createSocket | back to summary |
|---|---|
| public abstract Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException Creates a socket and connect it to the specified remote address on the specified remote port. The socket will also be bound to the local address and port supplied. The socket is configured using the socket options established for this factory.
| |
| getDefault | back to summary |
|---|---|
| public static SocketFactory getDefault() Returns a copy of the environment's default socket factory.
| |