commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walter Sunk <>
Subject Opening Sockets in project
Date Mon, 17 Mar 2008 14:24:51 GMT

When opening a Socket I need a connection timeout.
Otherwise if the server is not available the program hangs unlimited while trying to open
the Socket.

In the DefaultSocketFactory class a Socket is connected with:

public Socket createSocket(String host, int port)
throws UnknownHostException, IOException
   return new Socket(host, port);

What I need and what I propose would be:

public Socket createSocket(String host, int port, int timeout)
throws UnknownHostException, IOException
   Socket s = new Socket();
   s.connect(new InetSocketAddress(host,port),timeout);

Would it be possible to add a feature like that?

Walter from Austria

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message