886 return 0; |
886 return 0; |
887 } |
887 } |
888 } |
888 } |
889 |
889 |
890 /** Enable/disable SO_TIMEOUT with the specified timeout, in |
890 /** Enable/disable SO_TIMEOUT with the specified timeout, in |
891 * milliseconds. With this option set to a non-zero timeout, |
891 * milliseconds. With this option set to a positive timeout value, |
892 * a call to receive() for this DatagramSocket |
892 * a call to receive() for this DatagramSocket |
893 * will block for only this amount of time. If the timeout expires, |
893 * will block for only this amount of time. If the timeout expires, |
894 * a <B>java.net.SocketTimeoutException</B> is raised, though the |
894 * a <B>java.net.SocketTimeoutException</B> is raised, though the |
895 * DatagramSocket is still valid. The option <B>must</B> be enabled |
895 * DatagramSocket is still valid. A timeout of zero is interpreted |
896 * prior to entering the blocking operation to have effect. The |
896 * as an infinite timeout. |
897 * timeout must be {@code > 0}. |
897 * The option <B>must</B> be enabled prior to entering the blocking |
898 * A timeout of zero is interpreted as an infinite timeout. |
898 * operation to have effect. |
899 * |
899 * |
900 * @param timeout the specified timeout in milliseconds. |
900 * @param timeout the specified timeout in milliseconds. |
901 * @throws SocketException if there is an error in the underlying protocol, such as an UDP error. |
901 * @throws SocketException if there is an error in the underlying protocol, such as an UDP error. |
902 * @throws IllegalArgumentException if {@code timeout} is negative |
902 * @throws IllegalArgumentException if {@code timeout} is negative |
903 * @since 1.1 |
903 * @since 1.1 |