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

Diff of /classpath/java/net/DatagramSocket.java

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

revision 1.9 by arenn, Tue Apr 3 02:14:52 2001 UTC revision 1.10 by cbj, Tue Nov 27 03:12:02 2001 UTC
# Line 54  public class DatagramSocket Line 54  public class DatagramSocket
54  DatagramSocketImpl impl;  DatagramSocketImpl impl;
55    
56  /**  /**
57     * This is the local address which cannot be changed
58     */
59     private InetAddress local_addr;
60    
61    /**
62    * This is the address we are "connected" to    * This is the address we are "connected" to
63    */    */
64  private InetAddress remote_addr;  private InetAddress remote_addr;
# Line 133  DatagramSocket(int port, InetAddress add Line 138  DatagramSocket(int port, InetAddress add
138        if (addr == null)        if (addr == null)
139           addr = InetAddress.getInaddrAny();           addr = InetAddress.getInaddrAny();
140    
141          local_addr = addr;
142        impl.localPort = port;        impl.localPort = port;
143        impl.bind(port, addr);        impl.bind(port, addr);
144    
# Line 195  getLocalAddress() Line 201  getLocalAddress()
201    if (impl == null)    if (impl == null)
202      return(null);      return(null);
203    
   InetAddress addr = null;  
   try  
     {  
       addr = (InetAddress)impl.getOption(SocketOptions.SO_BINDADDR);  
     }  
   catch(SocketException e)  
     {  
       return(null);  
     }  
   
204    // FIXME: According to libgcj, checkConnect() is supposed to be called    // FIXME: According to libgcj, checkConnect() is supposed to be called
205    // before performing this operation.  Problems: 1) We don't have the    // before performing this operation.  Problems: 1) We don't have the
206    // addr until after we do it, so we do a post check.  2). The docs I    // addr until after we do it, so we do a post check.  2). The docs I
# Line 212  getLocalAddress() Line 208  getLocalAddress()
208    // we'll assume they mean both.    // we'll assume they mean both.
209    SecurityManager sm = System.getSecurityManager();    SecurityManager sm = System.getSecurityManager();
210    if (sm != null)    if (sm != null)
211      sm.checkConnect(addr.getHostName(), getLocalPort());      sm.checkConnect(local_addr.getHostName(), getLocalPort());
212    
213    return(addr);    return(local_addr);
214  }  }
215    
216  /*************************************************************************/  /*************************************************************************/

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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