Hi Hernán,

If you do lots of requests (downloads) or if you download large resources 
(files) and you get some networking exception, all you have to do is catch it, 
close the connection, maybe wait a couple of seconds and try again. There is 
(normally) no need for any more magic, unless you found a bug.

ZnClient has some basic support for this, see #numberOfRetries[:] 
#retryDelay[:] #timeout[:]

Of course, I do not know exactly what you are trying to do, what the 
other/server end is, what code you have written, what problems you see, what 
you networking quality is, and so on.

Switching the socket stream implementation is only necessary in very rare 
cases, it is not recommended that normal users do that.

HTH,

Sven

> On 18 Aug 2016, at 06:43, Hernán Morales Durand <hernan.mora...@gmail.com> 
> wrote:
> 
> Hi,
> 
> I have a situation where downloading lot of data results in ConnectionClosed.
> 
> >>httpGet: urlString
>     "Get the response from the given url"
>     
>     ^ [ ... .get: urlString ]
>         on: ZnEntityTooLarge, ConnectionClosed 
>         do: [ : ex | 
>             ex isResumable 
>                 ifTrue: [ ex resume ]
>                 ifFalse: [ self handleNonResumableConnection: ex ] ].
> 
> I read a mail from Sven you could change a global setting in 
> ZnNetworkingUtils as follows:
> 
> >>handleNonResumableConnection: anException
> 
>     | msg |
>     msg :=  'We got a non-resumable exception while connecting to ' , self 
> url host asString , '. Re-try switching ZdcSocketStream to SocketStream?'.
>     (self confirm: msg)
>         ifTrue: [ 
>             ZnNetworkingUtils default socketStreamClass: SocketStream.
>             anException retry.]    
> 
> But I would like to read about better handling, or recommendations.
> What do you think?
> 
> Cheers,
> 
> Hernán
> 
> 


Reply via email to