changeset 800:8c1c6e11204b

6755782: It is not clear how DatagramSocket deals with broadcast enabling/disabling Reviewed-by: jccollet
author chegar
date Wed, 14 Jan 2009 17:17:34 +0000
parents 13d7e2477737
children 7f6969c09075
files src/share/classes/java/net/DatagramSocket.java
diffstat 1 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/net/DatagramSocket.java	Tue Jan 13 09:21:54 2009 -0800
+++ b/src/share/classes/java/net/DatagramSocket.java	Wed Jan 14 17:17:34 2009 +0000
@@ -41,10 +41,11 @@
  * one machine to another may be routed differently, and may arrive in
  * any order.
  *
- * <p>UDP broadcasts sends are always enabled on a DatagramSocket.
- * In order to receive broadcast packets a DatagramSocket
- * should be bound to the wildcard address. In some
- * implementations, broadcast packets may also be received when
+ * <p> Where possible, a newly constructed {@code DatagramSocket} has the
+ * {@link SocketOptions#SO_BROADCAST SO_BROADCAST} socket option enabled so as
+ * to allow the transmission of broadcast datagrams. In order to receive
+ * 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.
  * <p>
  * Example:
@@ -1017,9 +1018,18 @@
 
     /**
      * Enable/disable SO_BROADCAST.
-     * @param on     whether or not to have broadcast turned on.
-     * @exception SocketException if there is an error
-     * in the underlying protocol, such as an UDP error.
+     *
+     * <p> Some operating systems may require that the Java virtual machine be
+     * 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
      * @see #getBroadcast()
      */