提交 ceb24f7a 编写于 作者: C chegar

6755782: It is not clear how DatagramSocket deals with broadcast enabling/disabling

Reviewed-by: jccollet
上级 43efc4e3
...@@ -41,10 +41,11 @@ import java.security.PrivilegedExceptionAction; ...@@ -41,10 +41,11 @@ import java.security.PrivilegedExceptionAction;
* one machine to another may be routed differently, and may arrive in * one machine to another may be routed differently, and may arrive in
* any order. * any order.
* *
* <p>UDP broadcasts sends are always enabled on a DatagramSocket. * <p> Where possible, a newly constructed {@code DatagramSocket} has the
* In order to receive broadcast packets a DatagramSocket * {@link SocketOptions#SO_BROADCAST SO_BROADCAST} socket option enabled so as
* should be bound to the wildcard address. In some * to allow the transmission of broadcast datagrams. In order to receive
* implementations, broadcast packets may also be received when * broadcast packets a DatagramSocket should be bound to the wildcard address.
* In some implementations, broadcast packets may also be received when
* a DatagramSocket is bound to a more specific address. * a DatagramSocket is bound to a more specific address.
* <p> * <p>
* Example: * Example:
...@@ -1017,9 +1018,18 @@ class DatagramSocket implements java.io.Closeable { ...@@ -1017,9 +1018,18 @@ class DatagramSocket implements java.io.Closeable {
/** /**
* Enable/disable SO_BROADCAST. * Enable/disable SO_BROADCAST.
* @param on whether or not to have broadcast turned on. *
* @exception SocketException if there is an error * <p> Some operating systems may require that the Java virtual machine be
* in the underlying protocol, such as an UDP error. * started with implementation specific privileges to enable this option or
* send broadcast datagrams.
*
* @param on
* whether or not to have broadcast turned on.
*
* @throws SocketException
* if there is an error in the underlying protocol, such as an UDP
* error.
*
* @since 1.4 * @since 1.4
* @see #getBroadcast() * @see #getBroadcast()
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册