code: public void setTimeToLive(int ttl) throws IOException {
          if (ttl < 0 || ttl > 255) {
              throw new IllegalArgumentException("ttl out of range");
          }
          if (isClosed())
              throw new SocketException("Socket is closed");
          getImpl().setTimeToLive(ttl);
      }
docs: Set the default time-to-live for multicast packets sent out
  on this {@code MulticastSocket} in order to control the
  scope of the multicasts.
  
  <P> The ttl <B>must</B> be in the range {@code  0 <= ttl <=
  255} or an {@code IllegalArgumentException} will be thrown.
  Multicast packets sent with a TTL of {@code 0} are not transmitted
  on the network but may be delivered locally.
  
  @param  ttl
  the time-to-live
  
  @throws  IOException
  if an I/O exception occurs while setting the
  default time-to-live value
  
  @see #getTimeToLive()