|
|
| |
SO_LINGER | Specify a linger-on-close timeout. This option disables/enables immediate return from a close()of a TCP Socket. Enabling this option with a non-zero Integer timeout means that a close() will block pending the transmission and acknowledgement of all data written to the peer, at which point the socket is closed gracefully. Upon reaching the linger timeout, the socket is closed forcefully, with a TCP RST. Enabling the option with a timeout of zero does a forceful close immediately. If the specified timeout value exceeds 65,535 it will be reduced to 65,535. | ||
SO_TIMEOUT | Set a timeout on blocking Socket operations: * <PRE> * ServerSocket.accept(); * SocketInputStream.read(); * DatagramSocket.receive(); * </PRE> The option must be set prior to entering a blocking operation to take effect. If the timeout expires and the operation would continue to block, <B>java.io.InterruptedIOException</B> is raised. The Socket is not closed in this case. | ||
SO_SNDBUF | Set a hint the size of the underlying buffers used by the platform for outgoing network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be sent over the socket. When used in get, this must return the size of the buffer actually used by the platform when sending out data on this socket. | ||
SO_RCVBUF | Set a hint the size of the underlying buffers used by the platform for incoming network I/O. When used in set, this is a suggestion to the kernel from the application about the size of buffers to use for the data to be received over the socket. When used in get, this must return the size of the buffer actually used by the platform when receiving in data on this socket. | ||
SO_KEEPALIVE | When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for 2 hours (NOTE: the actual value is implementation dependent), * TCP automatically sends a keepalive probe to the peer. This probe is a TCP segment to which the peer must respond. * One of three responses is expected: * 1. The peer responds with the expected ACK. The application is not notified (since everything is OK). TCP will send another probe following another 2 hours of inactivity. * 2. The peer responds with an RST, which tells the local TCP that the peer host has crashed and rebooted. The socket is closed. * 3. There is no response from the peer. The socket is closed. * The purpose of this option is to detect if the peer host crashes. | ||
SO_REUSEADDR | Used by MulticastSockets | ||
TCP_NODELAY | Disable Nagle's algorithm for this connection. Written data to the network is not buffered pending acknowledgement of previously written data | ||
public void connect(SocketAddress endpoint, int timeout) |
| ||
Nagle's algorithm:http://en.wikipedia.org/wiki/Nagle's_algorithm
Socket-faq: ftp://rtfm.mit.edu/pub/usenet/news.answers/unix-faq/socket