Enable/disable SO_TIMEOUT with the specified timeout, in
milliseconds. With this option set to a non-zero timeout,
a call to receive() for this DatagramSocket
will block for only this amount of time. If the timeout expires,
a
java.net.SocketTimeoutException is raised, though the
DatagramSocket 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.
Parameters:
-
timeout - the specified timeout in milliseconds.
Throws:
-
SocketException - if there is an error in the underlying protocol, such as an UDP error.
Since:
JDK1.1
See Also:
DatagramSocket.getSoTimeout()
,