commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Walter Sunk <s...@pressetext.at>
Subject Opening Sockets in commons.net project
Date Mon, 17 Mar 2008 14:24:51 GMT
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


Mime
View raw message