/[classpath]/classpath/gnu/java/net/PlainDatagramSocketImpl.java
ViewVC logotype

Diff of /classpath/gnu/java/net/PlainDatagramSocketImpl.java

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

revision 1.3 by mkoch, Fri Sep 26 21:37:54 2003 UTC revision 1.4 by mkoch, Mon Oct 20 14:10:07 2003 UTC
# Line 73  public final class PlainDatagramSocketIm Line 73  public final class PlainDatagramSocketIm
73          System.loadLibrary("javanet");          System.loadLibrary("javanet");
74        }        }
75    }    }
76      
77    /**    /**
78     * Option id for the IP_TTL (time to live) value.     * Option id for the IP_TTL (time to live) value.
79     */     */
# Line 82  public final class PlainDatagramSocketIm Line 82  public final class PlainDatagramSocketIm
82    /**    /**
83     * This is the actual underlying file descriptor     * This is the actual underlying file descriptor
84     */     */
85    protected int native_fd = -1;    int native_fd = -1;
86        
87    /**    /**
88     * Lock object to serialize threads wanting to receive     * Lock object to serialize threads wanting to receive
# Line 101  public final class PlainDatagramSocketIm Line 101  public final class PlainDatagramSocketIm
101    {    {
102    }    }
103    
104      protected void finalize() throws Throwable
105      {
106        synchronized (this)
107          {
108            if (native_fd != -1)
109              close();
110          }
111        super.finalize();
112      }
113    
114    public int getNativeFD()    public int getNativeFD()
115    {    {
116      return native_fd;      return native_fd;
# Line 248  public final class PlainDatagramSocketIm Line 258  public final class PlainDatagramSocketIm
258     */     */
259    protected synchronized byte getTTL() throws IOException    protected synchronized byte getTTL() throws IOException
260    {    {
261      Object obj = getOption(IP_TTL);      return (byte) getTimeToLive();
   
     if (!(obj instanceof Integer))  
       throw new IOException("Internal Error");  
   
     return(((Integer)obj).byteValue());  
262    }    }
263    
264    /**    /**
# Line 267  public final class PlainDatagramSocketIm Line 272  public final class PlainDatagramSocketIm
272     */     */
273    protected synchronized void setTTL(byte ttl) throws IOException    protected synchronized void setTTL(byte ttl) throws IOException
274    {    {
275      if (ttl > 0)      setTimeToLive(((int) ttl) & 0xFF);
       setOption(IP_TTL, new Integer(ttl));  
     else  
       setOption(IP_TTL, new Integer(ttl + 256));  
276    }    }
277    
278    /**    /**

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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