Hi Jimmie,

On 04 May 2011, at 00:53, Jimmie Houchin wrote:

> Hello,
> 
> I am happily use ZincHttpComponents, specifically ZnClient for my application.

That's good to hear.

> I make a request to the Python server part of my application which retrieves 
> data from another server. This at times takes longer than the provided 
> "timeout" for a connection.
> 
> I am currently doing,  ZnClient get:  url.
> 
> How can I increase the "timeout" for retrieving my data.

I know it is a bit confusing, but there are different HTTP clients inside Zn. 

ZnClient is the simplest one, it can only to one-shot requests, optionally with 
basic authentication. It supports proxies.

ZnFixedClient is a special client to repeatedly talk to the same host:port and 
reuse open connections, if possible. This makes it potentially faster.

ZnUserAgent and its subclass ZnHttpClient constitute a more sophisticated 
client with a richer API. Of these, ZnHttpClient has a more builder like API. 
They can follow redirects, allow the setting of timeout and other parameter and 
can do digest authentication.

To make a long story short, to do a GET with a custom timeout you can do:

| settings |
settings := (ZnUserAgentSettings defaultSettingsClass new) timeout: 60.
ZnHttpClient new
        settings: settings;
        url: 'http://zn.stfx.eu/random/256';
        get.

#get returns the response contents. If you want to access the actual ZnResponse 
(to see if the request was actually successful) use #response after doing a 
#get.

Let me know if this solves your problem or not. Zn is quite flexible, it all 
depends on your needs.

> Any help greatly appreciated.
> 
> Thanks.
> 
> Jimmie

HTH,

Sven


Reply via email to