You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "E. Dominguez" <e....@ticino.com> on 2006/09/18 10:28:44 UTC

[NET] ftp connection timeout

Hi all,

how can I set a timeout to an ftp connection?

In my program, if I try to connect to an unavailable ftp server the 
application hangs (better said waits...).
OS is iSeries's OS400 v5r3 or better.

[code]
FTPClient client = new FTPClient();
client.connect("myhost.com");
//application hangs waiting if no server responding...
client.login("user","password");
//(...)
[/code]

Kind regards

elvisd

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


Re: [NET] ftp connection timeout

Posted by Christian Hufgard <ch...@gmx.de>.
Hi,

I recently opened a issue on jira for this:

https://issues.apache.org/jira/browse/NET-141

At the moment the only chance is to set a custom SocketFactory. You might use the one attached to the jira issue (if you are using jdk 1.4 or above). In my tests it worked fine.
If you have to use a jdk below 1.4 you might take a look into the source of commons-httpclient. There is a Thread-based implementation that works also with jdk below 1.4

Greets,


Chris


-------- Original-Nachricht --------
Datum: Wed, 27 Sep 2006 09:14:45 -0400
Von: "Jamie Bisotti" <jb...@gmail.com>
An: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Betreff: Re: [NET] ftp connection timeout

> On 9/18/06, E. Dominguez <e....@ticino.com> wrote:
> >
> > Hi all,
> >
> > how can I set a timeout to an ftp connection?
> >
> > In my program, if I try to connect to an unavailable ftp server the
> > application hangs (better said waits...).
> > OS is iSeries's OS400 v5r3 or better.
> >
> > [code]
> > FTPClient client = new FTPClient();
> > client.connect("myhost.com");
> > //application hangs waiting if no server responding...
> > client.login("user","password");
> > //(...)
> > [/code]
> >
> > Kind regards
> >
> > elvisd
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> I don't have the docs in front of me at the moment, but I think there is
> another connect() method that takes a connection timeout.
> 
> -- 
> Jamie Bisotti

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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


Re: [NET] ftp connection timeout

Posted by Jamie Bisotti <jb...@gmail.com>.
On 9/18/06, E. Dominguez <e....@ticino.com> wrote:
>
> Hi all,
>
> how can I set a timeout to an ftp connection?
>
> In my program, if I try to connect to an unavailable ftp server the
> application hangs (better said waits...).
> OS is iSeries's OS400 v5r3 or better.
>
> [code]
> FTPClient client = new FTPClient();
> client.connect("myhost.com");
> //application hangs waiting if no server responding...
> client.login("user","password");
> //(...)
> [/code]
>
> Kind regards
>
> elvisd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
I don't have the docs in front of me at the moment, but I think there is
another connect() method that takes a connection timeout.

-- 
Jamie Bisotti