public class DefaultSocketFactory
extends javax.net.SocketFactory
SocketClient
implementations.SocketFactory
,
SocketClient
,
SocketClient.setSocketFactory(javax.net.SocketFactory)
构造器和说明 |
---|
DefaultSocketFactory()
The default constructor.
|
DefaultSocketFactory(java.net.Proxy proxy)
A constructor for sockets with proxy support.
|
限定符和类型 | 方法和说明 |
---|---|
java.net.ServerSocket |
createServerSocket(int port)
Creates a ServerSocket bound to a specified port.
|
java.net.ServerSocket |
createServerSocket(int port,
int backlog)
Creates a ServerSocket bound to a specified port with a given
maximum queue length for incoming connections.
|
java.net.ServerSocket |
createServerSocket(int port,
int backlog,
java.net.InetAddress bindAddr)
Creates a ServerSocket bound to a specified port on a given local
address with a given maximum queue length for incoming connections.
|
java.net.Socket |
createSocket()
Creates an unconnected Socket.
|
java.net.Socket |
createSocket(java.net.InetAddress address,
int port)
Creates a Socket connected to the given host and port.
|
java.net.Socket |
createSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a Socket connected to the given host and port and
originating from the specified local address and port.
|
java.net.Socket |
createSocket(java.lang.String host,
int port)
Creates a Socket connected to the given host and port.
|
java.net.Socket |
createSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a Socket connected to the given host and port and
originating from the specified local address and port.
|
public DefaultSocketFactory()
public DefaultSocketFactory(java.net.Proxy proxy)
proxy
- The Proxy to use when creating new Sockets.public java.net.Socket createSocket() throws java.io.IOException
createSocket
在类中 javax.net.SocketFactory
java.io.IOException
- If an I/O error occurs while creating the Socket.public java.net.Socket createSocket(java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOException
createSocket
在类中 javax.net.SocketFactory
host
- The hostname to connect to.port
- The port to connect to.java.net.UnknownHostException
- If the hostname cannot be resolved.java.io.IOException
- If an I/O error occurs while creating the Socket.public java.net.Socket createSocket(java.net.InetAddress address, int port) throws java.io.IOException
createSocket
在类中 javax.net.SocketFactory
address
- The address of the host to connect to.port
- The port to connect to.java.io.IOException
- If an I/O error occurs while creating the Socket.public java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddr, int localPort) throws java.net.UnknownHostException, java.io.IOException
createSocket
在类中 javax.net.SocketFactory
host
- The hostname to connect to.port
- The port to connect to.localAddr
- The local address to use.localPort
- The local port to use.java.net.UnknownHostException
- If the hostname cannot be resolved.java.io.IOException
- If an I/O error occurs while creating the Socket.public java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddr, int localPort) throws java.io.IOException
createSocket
在类中 javax.net.SocketFactory
address
- The address of the host to connect to.port
- The port to connect to.localAddr
- The local address to use.localPort
- The local port to use.java.io.IOException
- If an I/O error occurs while creating the Socket.public java.net.ServerSocket createServerSocket(int port) throws java.io.IOException
port
- The port on which to listen, or 0 to use any free port.java.io.IOException
- If an I/O error occurs while creating
the ServerSocket.public java.net.ServerSocket createServerSocket(int port, int backlog) throws java.io.IOException
port
- The port on which to listen, or 0 to use any free port.backlog
- The maximum length of the queue for incoming connections.java.io.IOException
- If an I/O error occurs while creating
the ServerSocket.public java.net.ServerSocket createServerSocket(int port, int backlog, java.net.InetAddress bindAddr) throws java.io.IOException
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.java.io.IOException
- If an I/O error occurs while creating
the ServerSocket.