Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1256293

Please move ttl from MulticastSocket.send() to a different function.

XMLWordPrintable

    • 1.1fcs
    • sparc
    • solaris_2.5
    • Not verified

      Currently the class MulticastSocket is in sun.net. I've heard that it's moving to java.net in the next release. The send() method of MulticastSocket takes two parameters: the packet to send, and the ttl with which to send the packet. I feel that setting the ttl should be done by a separate function for several reasons:

      - Setting the ttl and sending packets are different operations.
      - I might want to set the ttl without sending a packet, for instance, just after I open the socket.
      - It's not obvious that there are actually two send() methods: the one with two arguments in MulticastSocket, and the one with one argument in DatagramSocket, which sends with the last set ttl.

      If the two argument send() is thrown out, then it will still be possible, though more difficult, to send individual packets with specified ttls by synchronizing on the MulticastSocket object.
      If the two argument send() is not thrown out, then I would recommend that the documentation for the new setttl() function clearly state that DatagramSocket.send() can be used to send packets and that they will be sent with the set ttl.

            djbrown David Brown (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: