public class TCPSocket
extends java.lang.Object
EncryptedSocket
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TCP_CONNECT_TIMEOUT_MILLIS
The default TCP connect timeout in milliseconds = 10000.
|
Constructor and Description |
---|
TCPSocket(java.lang.String serverHost,
int serverPort)
Create a new instance with an unconnected socket.
|
Modifier and Type | Method and Description |
---|---|
java.net.Socket |
connect()
Connect the socket to the server.
|
long |
getTCPConnectTime()
Get the TCP/IP connect time for opening the network connection to the server.
|
void |
setLocalOutboundAddress(java.net.InetAddress localOutboundAddress)
Set a specific outbound IP address.
|
void |
setTCPConnectTimeoutMillis(int tcpConnectTimeoutMillis)
Set the TCP connect timeout.
|
public static final int DEFAULT_TCP_CONNECT_TIMEOUT_MILLIS
public TCPSocket(java.lang.String serverHost, int serverPort)
serverHost
- the hostname or IP address of the serverserverPort
- the TPC/IP port of the serverconnect()
public void setTCPConnectTimeoutMillis(int tcpConnectTimeoutMillis)
tcpConnectTimeoutMillis
- the TCP connect timeout in millisecondsDEFAULT_TCP_CONNECT_TIMEOUT_MILLIS
public void setLocalOutboundAddress(java.net.InetAddress localOutboundAddress)
localOutboundAddress
- the specific outbound IP addresspublic java.net.Socket connect() throws java.io.IOException
java.io.IOException
- if somewhat failspublic long getTCPConnectTime()