Client socket (also called just "socket").
A socket is an endpoint for communication between two machines.
Constructor
Socket(
string remoteAddr,
int remotePort)
Socket(
InetAddress remoteAddr,
int remotePort)
Socket(
InetAddress remoteAddr,
int remotePort,
InetAddress localAddr,
int localPort)
Socket(
string remoteAddr,
int remotePort,
string localAddr,
int localPort)
Socket(
InetAddress remoteAddr,
int remotePort,
string localAddr,
int localPort)
Socket(
string remoteAddr,
int remotePort,
string localAddr,
int localPort)
Creates a new socket to given remoteAddr and remotePort.
Socket is bound locally either to default address and random port or
given localAddr and localPort.
| Throws |
IOError -
if an IO error occured
|
Methods
Closes this socket.
| Throws |
IOError -
If an IO error occured
|
Returns the remote IP address to which this socket has been bound to.
Gets the input stream of this socket.
| Throws |
IOError -
If an IO error occured
|
Returns the local IP address to which this socket has been bound to.
Returns the local port to which this socket has been bound to.
Gets the output stream of this socket.
| Throws |
IOError -
If an IO error occured
|
Returns the remote port to which this socket has been bound to.
A datagram socket option.
| Returns |
buffer size |
| Throws |
SocketError -
If an error occured
|
A datagram socket option.
| Returns |
buffer size |
| Throws |
SocketError -
If an error occured
|
Returns setting for SO_LINGER.
| Returns |
SO_LINGER, -1 implies that the option is disabled. |
| Throws |
SocketError -
If an error occured
|
Returns the setting for SO_TIMEOUT, in milliseconds.
| Returns |
SO_TIMEOUT, 0 implies that the option is
disabled (i.e., timeout of infinity). |
| Throws |
SocketError -
If an error occured
|
| Returns |
the value of TCP_NODELAY option. |
| Throws |
SocketError -
If an error occured
|
A datagram socket option.
| Throws |
SocketError -
If an error occured
|
A datagram socket option.
| Throws |
SocketError -
If an error occured
|
Enable/disable SO_LINGER with the specified linger time in seconds.
If the specified timeout value exceeds 65,535 it will be reduced to 65,535.
| Throws |
SocketError -
If an error occured
|
Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
With this option set to a non-zero timeout, a read() call on the
InputStream associated with this Socket will block for only this
amount of time. If the timeout expires, a read operation is
interrupted , though the Socket is still valid.
The option must be enabled prior to
entering the blocking operation to have effect.
The timeout must be > 0. A timeout of zero
is interpreted as an infinite timeout.
| Throws |
SocketError -
If an error occured
|
Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm).
| Throws |
SocketError -
If an error occured
|