/[classpath]/classpath/java/net/MulticastSocket.java
ViewVC logotype

Diff of /classpath/java/net/MulticastSocket.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by mkoch, Tue Dec 2 10:33:56 2003 UTC revision 1.22 by mkoch, Tue Dec 2 10:50:56 2003 UTC
# Line 124  public class MulticastSocket extends Dat Line 124  public class MulticastSocket extends Dat
124      if (isClosed())      if (isClosed())
125        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
126    
127      return (InetAddress) impl.getOption(SocketOptions.IP_MULTICAST_IF);      return (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
128    }    }
129    
130    /**    /**
# Line 148  public class MulticastSocket extends Dat Line 148  public class MulticastSocket extends Dat
148      // Use getTTL here rather than getTimeToLive in case we're using an impl      // Use getTTL here rather than getTimeToLive in case we're using an impl
149      // other than the default PlainDatagramSocketImpl and it doesn't have      // other than the default PlainDatagramSocketImpl and it doesn't have
150      // getTimeToLive yet.      // getTimeToLive yet.
151      return impl.getTTL();      return getImpl().getTTL();
152    }    }
153    
154    /**    /**
# Line 166  public class MulticastSocket extends Dat Line 166  public class MulticastSocket extends Dat
166      if (isClosed())      if (isClosed())
167        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
168    
169      return impl.getTimeToLive();      return getImpl().getTimeToLive();
170    }    }
171    
172    /**    /**
# Line 183  public class MulticastSocket extends Dat Line 183  public class MulticastSocket extends Dat
183      if (isClosed())      if (isClosed())
184        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
185    
186      impl.setOption(SocketOptions.IP_MULTICAST_IF, addr);      getImpl().setOption(SocketOptions.IP_MULTICAST_IF, addr);
187    }    }
188    
189    /**    /**
# Line 206  public class MulticastSocket extends Dat Line 206  public class MulticastSocket extends Dat
206      Enumeration e = netIf.getInetAddresses ();      Enumeration e = netIf.getInetAddresses ();
207    
208      if (!e.hasMoreElements ())      if (!e.hasMoreElements ())
209        throw new SocketException ("MulticastSocket: Error");        throw new SocketException("no network devices found");
210    
211      InetAddress address = (InetAddress) e.nextElement ();      InetAddress address = (InetAddress) e.nextElement ();
212      impl.setOption (SocketOptions.IP_MULTICAST_IF, address);      getImpl().setOption (SocketOptions.IP_MULTICAST_IF, address);
213    }    }
214    
215    /**    /**
# Line 230  public class MulticastSocket extends Dat Line 230  public class MulticastSocket extends Dat
230        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
231    
232      InetAddress address =      InetAddress address =
233              (InetAddress) impl.getOption (SocketOptions.IP_MULTICAST_IF);        (InetAddress) getImpl().getOption (SocketOptions.IP_MULTICAST_IF);
234      NetworkInterface netIf = NetworkInterface.getByInetAddress (address);      NetworkInterface netIf = NetworkInterface.getByInetAddress (address);
235    
236      return netIf;      return netIf;
# Line 255  public class MulticastSocket extends Dat Line 255  public class MulticastSocket extends Dat
255      if (isClosed())      if (isClosed())
256        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
257    
258      impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable));      getImpl().setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable));
259    }    }
260    
261    /**    /**
# Line 270  public class MulticastSocket extends Dat Line 270  public class MulticastSocket extends Dat
270      if (isClosed())      if (isClosed())
271        throw new SocketException("socket is closed");        throw new SocketException("socket is closed");
272    
273      Object obj = impl.getOption (SocketOptions.IP_MULTICAST_LOOP);      Object buf = getImpl().getOption (SocketOptions.IP_MULTICAST_LOOP);
274    
275      if (obj instanceof Boolean)      if (buf instanceof Boolean)
276        return ((Boolean) obj).booleanValue ();        return ((Boolean) buf).booleanValue();
277      else      
278        throw new SocketException ("Unexpected type");      throw new SocketException("unexpected type");
279    }    }
280    
281    /**    /**
# Line 298  public class MulticastSocket extends Dat Line 298  public class MulticastSocket extends Dat
298      // Use setTTL here rather than setTimeToLive in case we're using an impl      // Use setTTL here rather than setTimeToLive in case we're using an impl
299      // other than the default PlainDatagramSocketImpl and it doesn't have      // other than the default PlainDatagramSocketImpl and it doesn't have
300      // setTimeToLive yet.      // setTimeToLive yet.
301      impl.setTTL(ttl);      getImpl().setTTL(ttl);
302    }    }
303    
304    /**    /**
# Line 319  public class MulticastSocket extends Dat Line 319  public class MulticastSocket extends Dat
319      if (ttl <= 0 || ttl > 255)      if (ttl <= 0 || ttl > 255)
320        throw new IllegalArgumentException("Invalid ttl: " + ttl);        throw new IllegalArgumentException("Invalid ttl: " + ttl);
321    
322      impl.setTimeToLive(ttl);      getImpl().setTimeToLive(ttl);
323    }    }
324    
325    /**    /**
# Line 343  public class MulticastSocket extends Dat Line 343  public class MulticastSocket extends Dat
343      if (s != null)      if (s != null)
344        s.checkMulticast(mcastaddr);        s.checkMulticast(mcastaddr);
345    
346      impl.join(mcastaddr);      getImpl().join(mcastaddr);
347    }    }
348    
349    /**    /**
# Line 367  public class MulticastSocket extends Dat Line 367  public class MulticastSocket extends Dat
367      if (s != null)      if (s != null)
368        s.checkMulticast(mcastaddr);        s.checkMulticast(mcastaddr);
369    
370      impl.leave(mcastaddr);      getImpl().leave(mcastaddr);
371    }    }
372    
373    /**    /**
# Line 406  public class MulticastSocket extends Dat Line 406  public class MulticastSocket extends Dat
406      if (s != null)      if (s != null)
407        s.checkMulticast (tmp.getAddress ());        s.checkMulticast (tmp.getAddress ());
408    
409      impl.joinGroup (mcastaddr, netIf);      getImpl().joinGroup (mcastaddr, netIf);
410    }    }
411        
412    /**    /**
# Line 441  public class MulticastSocket extends Dat Line 441  public class MulticastSocket extends Dat
441      if (s != null)      if (s != null)
442        s.checkMulticast (tmp.getAddress ());        s.checkMulticast (tmp.getAddress ());
443    
444      impl.leaveGroup (mcastaddr, netIf);      getImpl().leaveGroup (mcastaddr, netIf);
445    }    }
446        
447    /**    /**
# Line 475  public class MulticastSocket extends Dat Line 475  public class MulticastSocket extends Dat
475            s.checkConnect(addr.getHostAddress(), p.getPort());            s.checkConnect(addr.getHostAddress(), p.getPort());
476        }        }
477    
478      int oldttl = impl.getTimeToLive();      int oldttl = getImpl().getTimeToLive();
479      impl.setTimeToLive(((int) ttl) & 0xFF);      getImpl().setTimeToLive(((int) ttl) & 0xFF);
480      impl.send(p);      getImpl().send(p);
481      impl.setTimeToLive(oldttl);      getImpl().setTimeToLive(oldttl);
482    }    }
483  } // class MulticastSocket  } // class MulticastSocket

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26