[NET] ftp connection timeout

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[NET] ftp connection timeout

e.dominguez
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [NET] ftp connection timeout

Jamie Bisotti
On 9/18/06, E. Dominguez <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
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
Reply | Threaded
Open this post in threaded view
|

Re: [NET] ftp connection timeout

Christian Hufgard
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" <[hidden email]>
An: "Jakarta Commons Users List" <[hidden email]>
Betreff: Re: [NET] ftp connection timeout

> On 9/18/06, E. Dominguez <[hidden email]> 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: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
> 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: [hidden email]
For additional commands, e-mail: [hidden email]