Internet connection active

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

Internet connection active

Trussardi Dario Romano
Ciao,

i have a Pharo 7.0.3 image run on Ubuntu system.

Sometime the internet connection go down.

In this status when i do the:

NetNameResolver addressForName:  'www.esug.org'  timeout: 1

the system is busy for 20 seconds ( for any request ).

The timeout: 1 is not considered.

Question:  how i can test if the internet connection is up before submit any NetNameResolver request ?

Googling in VisualBasic i found the ActiveConnection

It return true if internet connection is active.

Equivalent in Pharo - Gemstone ?

Thanks,

Dario
Reply | Threaded
Open this post in threaded view
|

Re: Internet connection active

Sven Van Caekenberghe-2
Hi,

This is a known problem: the standard NetNameResolver (which depends on some primitives) hangs when your network connection is bad (or in a dubious state).

This is very annoying, if your test is 'do I have an internet connection'.

This is the reason why I played with https://github.com/svenvc/NeoDNS doing a pure Pharo DNS client (based on datagrams) - this one does never hang. But doing a full DNS client is hard. BTW, this code base also contains a 'do I have an internet connection' test.

Sven

> On 10 Apr 2020, at 13:15, dario.trussardi65 <[hidden email]> wrote:
>
> Ciao,
>
> i have a Pharo 7.0.3 image run on Ubuntu system.
>
> Sometime the internet connection go down.
>
> In this status when i do the:
>
> NetNameResolver addressForName:  'www.esug.org'  timeout: 1
>
> the system is busy for 20 seconds ( for any request ).
>
> The timeout: 1 is not considered.
>
> Question:  how i can test if the internet connection is up before submit any NetNameResolver request ?
>
> Googling in VisualBasic i found the ActiveConnection
>
> It return true if internet connection is active.
>
> Equivalent in Pharo - Gemstone ?
>
> Thanks,
>
> Dario


Reply | Threaded
Open this post in threaded view
|

Re: Internet connection active

SergeStinckwich
Is it related to the issue we have from time to time when we load software with Metacello from countries where bandwidth is limited.

Regards,

On Thu, Apr 16, 2020 at 4:17 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi,

This is a known problem: the standard NetNameResolver (which depends on some primitives) hangs when your network connection is bad (or in a dubious state).

This is very annoying, if your test is 'do I have an internet connection'.

This is the reason why I played with https://github.com/svenvc/NeoDNS doing a pure Pharo DNS client (based on datagrams) - this one does never hang. But doing a full DNS client is hard. BTW, this code base also contains a 'do I have an internet connection' test.

Sven

> On 10 Apr 2020, at 13:15, dario.trussardi65 <[hidden email]> wrote:
>
> Ciao,
>
>       i have a Pharo 7.0.3 image run on Ubuntu system.
>
>       Sometime the internet connection go down.
>
>       In this status when i do the:
>
>               NetNameResolver addressForName:  'www.esug.org'  timeout: 1
>
>       the system is busy for 20 seconds ( for any request ).
>
>       The             timeout: 1      is not considered.
>
>       Question:  how i can test if the internet connection is up before submit any NetNameResolver request ?
>
>       Googling in VisualBasic i found the ActiveConnection
>
>               It return true if internet connection is active.
>
>       Equivalent in Pharo - Gemstone ?
>
>       Thanks,
>
>               Dario




--
Serge Stinckwic
​h​
https://twitter.com/SergeStinckwich