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

Diff of /classpath/java/net/PlainSocketImpl.java

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

revision 1.14 by rupp, Wed Jul 30 10:09:46 2003 UTC revision 1.15 by mkoch, Wed Jul 30 14:35:24 2003 UTC
# Line 167  class PlainSocketImpl extends SocketImpl Line 167  class PlainSocketImpl extends SocketImpl
167    protected native void connect(InetAddress addr, int port)    protected native void connect(InetAddress addr, int port)
168      throws IOException;      throws IOException;
169    
170    protected void connect(SocketAddress address, int timeout)    protected synchronized void connect(SocketAddress address, int timeout)
171      throws IOException          throws IOException
172    {    {
173      // NYI: this method need to support timeout      InetSocketAddress sockAddr = (InetSocketAddress) address;
174      if (address instanceof InetSocketAddress)      InetAddress addr = sockAddr.getAddress();
175    
176        if (addr == null)
177          throw new IllegalArgumentException ("address is unresolved: " + sockAddr);
178    
179        int port = sockAddr.getPort();
180        
181        if (timeout < 0)
182          throw new IllegalArgumentException ("negative timeout");
183    
184        Object oldTimeoutObj = null;
185        
186        try
187        {        {
188          connect(((InetSocketAddress) address).getAddress(),          oldTimeoutObj = this.getOption (SocketOptions.SO_TIMEOUT);
189                  ((InetSocketAddress) address).getPort()    );          this.setOption (SocketOptions.SO_TIMEOUT, new Integer (timeout));
190            connect (addr, port);
191        }        }
192      else      finally
193        {        {
194          throw new InternalError("PlainSocketImpl:connect not implemented for anything other than InetSocketAddress");          if (oldTimeoutObj != null)
195              this.setOption (SocketOptions.SO_TIMEOUT, oldTimeoutObj);
196        }        }
       //     throw new InternalError ("PlainSocketImpl::connect not implemented");  
197    }    }
198    
199    /**    /**

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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