You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2006/11/13 00:07:14 UTC
Re: [commons ftp] help! FTPClient.isConnected() does not work.
In message <45...@eircom.net>, 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [commons ftp] help! FTPClient.isConnected() does not work.
Posted by Rory Winston <rw...@eircom.net>.
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 <45...@eircom.net>, 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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org