Thanks for the feedback Daniel. I think you may be right about adding the code to the factory - it may be a more elegant solution than adding it to SocketClient.

Cheers
Rory

Daniel F. Savarese wrote:
In message <[EMAIL PROTECTED]>, Rory Winston writes:
I knwo you said that you were going to have a look at adding connect timeout functionality to FTPClient. I had some spare time today, and I decided to see if I could give it a go on the 2.0 branch. However, I

Sorry.  I plum forgot.  Thanks for taking it on.

would be grateful if you could give it an eyeball and see if you think it is an acceptable solution. I have made changes to SocketClient and added a simple test case.

The changes could be moved into the socket factory with
SocketClient.setConnectTimeout being a passthrough to the factory's
setConnectTimeout.  That way, no extra code has to be added to
other places where a factory is used in a SocketClient subclass, such as
such as when FTPClient establishes a passive mode data connection.  But
that's just a first impression that could be off base.

With or without that, I think it's safe to change
  if (connectTimeout == DEFAULT_CONNECT_TIMEOUT)
    _socket_.connect(new InetSocketAddress(hostname, port));
  else
   _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
to simply:
   _socket_.connect(new InetSocketAddress(hostname, port), connectTimeout);
because
    _socket_.connect(new InetSocketAddress(hostname, port));
has the same effect as:
    _socket_.connect(new InetSocketAddress(hostname, port), 0);

daniel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to