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.
- 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.