[Gambas-user] Connection to the Internet ...
adamnt42 at gmail.com
Wed Jun 16 10:36:55 CEST 2021
On Tue, 2021-06-15 at 14:49 +0200, Hans Lehmann wrote:
> I am looking for a way to find out for sure whether from my PC there
> is currently
> (a) a connection to the local router and then
> (b) also to the Internet.
> With kind regards
The others' answers are good but i have to ask.
for a) Since you are trying to find your "local router" then surely
it's IP address is fixed and known, e.g. 192.168.0.1 or 10.0.0.1.
So you could check connectivity just with
ping -c1 -w0 <insert your routers IP here>|grep transmitted
(you might have to vary the -w factor to cope with any local network
for b) there are many, many possible ways none to my knowledge all that
"foolproof". The one I think is the best is to try to query one of the
ARPAnet name servers for a "generally well known" address. There is a
quick way to do a DNS lookup via one of the system network utilities
but its a long time since I used them so someone else will need to help
@others: Yep that method usinng awk is very slow, incredibly slow even.
But I have no idea why?
More information about the User