You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Walter Sunk <su...@pressetext.at> on 2008/03/17 15:24:51 UTC

Opening Sockets in commons.net project

Hello,

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?


Regards,
Walter from Austria

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org