Test the WiFi connection

Post Reply
Henko
Posts: 840
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Test the WiFi connection

Post by Henko »

While playing an on-line game on the PC, i came to suspect the quality of the internet connection. Although the “WiFi” led on the router was lit continuously, the connection seemed to be interrupted often for a short time.

To get “proof”, i made a little SB program. It does a “ping” command every second to the IP address of Google, and writes a record with date/time info to a file whenever the response of the ping command is zero (i.e. “no connection”).
This file looks like:
IMG_1381.jpeg
IMG_1381.jpeg (162.67 KiB) Viewed 118 times
This info may help the internetprovider to see what the problem is.

Code: Select all

' test WiFi connection
'
f$="WiFi_test.txt"
if file_exists(f$) then file f$ delete
get_time()
file f$ print "Start at "&dt$
print "Start at "&dt$
do slowdown
  get_time()
  if s<>so then
    so=s ! sec+=1
    if ping("8.8.8.8")=1 then continue      ' connected
    file f$ print "no WiFi at "&dt$&" "&sec ' not connected
    print         "no WiFi at "&dt$
    beep
    end if
  until forever
end

def get_time()
.yy=CURRENT_YEAR ()
.mm=CURRENT_MONTH ()
.dd=CURRENT_DATE ()
.h=CURRENT_HOUR ()
.m=CURRENT_MINUTE ()
.s=CURRENT_SECOND ()
.dt$=.dd&"-"&.mm&"-"&.yy&" / "&.h&"u"&"-"&.m&"m"&"-"&.s&"s"
end def

Chooch912
Posts: 54
Joined: Thu Apr 12, 2018 6:16 pm
My devices: iPad
Flag: United States of America

Re: Test the WiFi connection

Post by Chooch912 »

Very interesting!

I ran your program for 15 minutes using the Google IP Address and received no "no WiFi" hits.

But when I duplicated the program using my IP Address (and file name) I was getting "no WiFi" a bit over every 10 seconds.
IMG_9902.png
IMG_9902.png (376.56 KiB) Viewed 94 times
Any idea what is going on with this?

Henko
Posts: 840
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Test the WiFi connection

Post by Henko »

I have no idea.
I will try that here, polling my own IP address. If i get the same result, i wll ask around, because i want to know what’s happening.

Henko
Posts: 840
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Test the WiFi connection

Post by Henko »

Yes, i get the same result while “pinging” the IP adress of my router. I’ll look into that.

Henko
Posts: 840
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Test the WiFi connection

Post by Henko »

I asked my sun:

Hoi,

Niet alle apparaten zijn geconfigureerd om op een ping te antwoorden.
(Not all hardware units are configured to answer a ping)

https://en.wikipedia.org/wiki/Internet_ ... e_Protocol

Groets,

User avatar
Dutchman
Posts: 873
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: Test the WiFi connection

Post by Dutchman »

I ran the program for two days. It's remarkable that after a few hours, the interval remains almost constant at two hours.
Provider: KPN (NL), via fiber optic
file content.jpg
file content.jpg (58.96 KiB) Viewed 48 times

Chooch912
Posts: 54
Joined: Thu Apr 12, 2018 6:16 pm
My devices: iPad
Flag: United States of America

Re: Test the WiFi connection

Post by Chooch912 »

I asked my ISP why, when I use my IP address, I get "no WiFi" every 10 seconds but they haven't replied.

Because I am in the USA I modified the program so the hour shows as "h" rather than "u" and the date format is "mm/dd/yyyy". I wanted the month to show as "Jan, Feb, Mar, etc" instead of as a number. I am not real experienced at !Basic coding and changed the month "number" to the month "abbreviation" using the lines below. How could I have done that easier?

if .mm=1 then .mm$="Jan"
if .mm=2 then .mm$="Feb"
if .mm=3 then .mm$="Mar"
if .mm=4 then .mm$="Apr"
if .mm=5 then .mm$="May"
if .mm=6 then .mm$="Jun"
if .mm=7 then .mm$="Jul"
if .mm=8 then .mm$="Aug"
if .mm=9 then .mm$="Sep"
if .mm=10 then .mm$="Oct"
if .mm=11 then .mm$="Nov"
if .mm=12 then .mm$="Dec"

Chooch912
Posts: 54
Joined: Thu Apr 12, 2018 6:16 pm
My devices: iPad
Flag: United States of America

Re: Test the WiFi connection

Post by Chooch912 »

After asking my ISP about the "no WiFi" every 10 seconds using my IP address they did a "reset" of my router and fiber input but I still get the "no WiFi" every 10 seconds, so resetting did nothing and they have no answer as to why this anomaly is occurring.

Notice I did modify the program to match US date format and US "hour" designation. I really like this program!

Start at Nov-19-2025 / 15h-22m-52s
no WiFi at Nov-19-2025 / 15h-22m-52s
no WiFi at Nov-19-2025 / 15h-23m-2s
no WiFi at Nov-19-2025 / 15h-23m-12s
no WiFi at Nov-19-2025 / 15h-23m-22s
no WiFi at Nov-19-2025 / 15h-23m-32s
no WiFi at Nov-19-2025 / 15h-23m-42s
no WiFi at Nov-19-2025 / 15h-23m-52s
no WiFi at Nov-19-2025 / 15h-24m-2s
no WiFi at Nov-19-2025 / 15h-24m-12s

Henko
Posts: 840
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Test the WiFi connection

Post by Henko »

Like my son explained to me: a router may not be configured to handle “ping” requests from the internal network to the router itself.
In that case, the ping request does not get an answer, and apparently the ping command keeps trying to get an answer for 10 seconds, and then concludes with a “0” response.

As for the translation from month numbers into month abbreviations, it may be coded shorter as follows:

DIM month$(13)
FOR i=1 to 12 ! READ month$(i) ! NEXT i
DATA “jan”,”feb”, ……. , “dec”

And in the main program, when m is the month number, use simply month$(i)

Somewhat more elegant, and certainly preferable if the translation is needed in several programs, is to code the translation in a function, which may then be called werever the translation is needed.

For instance, if the function is given the name m2m$ (from number to namestring):

DEF m2m$(m)
IF NOT initialized THEN
initialized=1
DIM month$(13)
FOR i=1 to 12 ! READ month$(i) ! NEXT i
DATA “jan”,”feb”, ……. , “dec”
END IF
RETURN month$(m)
END DEF

If the translation is needed in any program, the function has to be added to the code module, and
in the progam it is called as:

m=….
month$=m2m$(m) (to set a variable month$),

or

PRINT m2m$(m) & “was the hottest month this year!” (Or any other embedded usage)

Post Reply