Re: [Pharo-users] How to detect wheter the computer is connected to the internet ?

2015-12-14 Thread Dimitris Chloupis
Thank you both, an exception handling is what i was considering too but I
thought a second opinion would not hurt. And yes I agree I need to check
that github is online or that the user can access it.

By the way that timeout argument is in milliseconds ?

On Mon, Dec 14, 2015 at 9:53 AM Peter Uhnak  wrote:

> On 12/14, Sven Van Caekenberghe wrote:
> > Hi Dimitris,
> >
> > > On 14 Dec 2015, at 07:02, Dimitris Chloupis 
> wrote:
> > >
> > > Hey guys I try to make a way to detect whether my project is up to
> date and if not to update it from the github repo automagically. This part
> works fine , but I will also like to first detect whether the computer has
> an internet connection so to avoid unnecessary errors and checks .
> > >
> > > Is that possible ?
> >
> > Just try accessing a well know, always available host with a short
> timeout ?
> >
> > [ ZnClient new beOneShot; timeout: 2; get: 'http://www.google.com';
> isSuccess ] on: Error do: [ false ]
> >
>
> You should try to contact github, not google, since that's what you care
> about. After all github can be down sometimes so it would fail even with
> internet connection.
>
> Peter
>
>


Re: [Pharo-users] How to detect wheter the computer is connected to the internet ?

2015-12-14 Thread Sven Van Caekenberghe
Use the source, Luke:

ZnClient>>#timeout: seconds
"Set the timeout for network socket stream operations
like connecting, reading and writing to seconds."

self optionAt: #timeout put: seconds

;-)

> On 14 Dec 2015, at 10:31, Dimitris Chloupis  wrote:
> 
> Thank you both, an exception handling is what i was considering too but I 
> thought a second opinion would not hurt. And yes I agree I need to check that 
> github is online or that the user can access it.
> 
> By the way that timeout argument is in milliseconds ? 
> 
> On Mon, Dec 14, 2015 at 9:53 AM Peter Uhnak  wrote:
> On 12/14, Sven Van Caekenberghe wrote:
> > Hi Dimitris,
> >
> > > On 14 Dec 2015, at 07:02, Dimitris Chloupis  wrote:
> > >
> > > Hey guys I try to make a way to detect whether my project is up to date 
> > > and if not to update it from the github repo automagically. This part 
> > > works fine , but I will also like to first detect whether the computer 
> > > has an internet connection so to avoid unnecessary errors and checks .
> > >
> > > Is that possible ?
> >
> > Just try accessing a well know, always available host with a short timeout ?
> >
> > [ ZnClient new beOneShot; timeout: 2; get: 'http://www.google.com'; 
> > isSuccess ] on: Error do: [ false ]
> >
> 
> You should try to contact github, not google, since that's what you care
> about. After all github can be down sometimes so it would fail even with
> internet connection.
> 
> Peter
> 




[Pharo-users] How to detect wheter the computer is connected to the internet ?

2015-12-13 Thread Dimitris Chloupis
Hey guys I try to make a way to detect whether my project is up to date and
if not to update it from the github repo automagically. This part works
fine , but I will also like to first detect whether the computer has an
internet connection so to avoid unnecessary errors and checks .

Is that possible ?


Re: [Pharo-users] How to detect wheter the computer is connected to the internet ?

2015-12-13 Thread Peter Uhnak
On 12/14, Sven Van Caekenberghe wrote:
> Hi Dimitris,
> 
> > On 14 Dec 2015, at 07:02, Dimitris Chloupis  wrote:
> > 
> > Hey guys I try to make a way to detect whether my project is up to date and 
> > if not to update it from the github repo automagically. This part works 
> > fine , but I will also like to first detect whether the computer has an 
> > internet connection so to avoid unnecessary errors and checks .
> > 
> > Is that possible ?  
> 
> Just try accessing a well know, always available host with a short timeout ?
> 
> [ ZnClient new beOneShot; timeout: 2; get: 'http://www.google.com'; isSuccess 
> ] on: Error do: [ false ]
> 

You should try to contact github, not google, since that's what you care
about. After all github can be down sometimes so it would fail even with
internet connection.

Peter



Re: [Pharo-users] How to detect wheter the computer is connected to the internet ?

2015-12-13 Thread Sven Van Caekenberghe
Hi Dimitris,

> On 14 Dec 2015, at 07:02, Dimitris Chloupis  wrote:
> 
> Hey guys I try to make a way to detect whether my project is up to date and 
> if not to update it from the github repo automagically. This part works fine 
> , but I will also like to first detect whether the computer has an internet 
> connection so to avoid unnecessary errors and checks .
> 
> Is that possible ?  

Just try accessing a well know, always available host with a short timeout ?

[ ZnClient new beOneShot; timeout: 2; get: 'http://www.google.com'; isSuccess ] 
on: Error do: [ false ]

HTH,

Sven

https://medium.com/concerning-pharo/pharo-days-2016-c52fe4d7caf