I'm trying to check to see if I have an internet connection or not.
Using the code below, I thought "ok" would be 0 if I didn't have an internet connection or the
web site was down.
ok = NETWEBGET("upperdeck.host-ed.net", str$, 80, "leaderboard.dat")
PRINT ok, 10,10
"ok" is always 1, even if I change the name of the server to a non-existing server.
any suggestions?
thanks
Mike
Quote from: millerszone on 2011-Jan-19
I'm trying to check to see if I have an internet connection or not.
Using the code below, I thought "ok" would be 0 if I didn't have an internet connection or the
web site was down.
ok = NETWEBGET("upperdeck.host-ed.net", str$, 80, "leaderboard.dat")
PRINT ok, 10,10
"ok" is always 1, even if I change the name of the server to a non-existing server.
To test I was just changing the server name.. (example: "upperdeck.host-ed.net to upperdeck.net)
but was getting ok=1, but if I disable my network card or leave the server name blank, then I get a ok=0.
Fixed now.
That's because if you try to open an unexistent web, the Internet returns a Pagd not found error
Best way would be some sort of PING utility to a site that wont disappear.
No way of doing a normal ping in glbasic, mabe open a tcp port 80 to google or something :-)
right. Something like:
SOCK_INIT
sock% = SOCK_TCP_CONENCT("ww.google.com", 80)
IF sock>0 THEN bInternet=TRUE // check return value. Is it 0 or -1 on error?
SOCK_CLOSE(sock)
SOCK_SHUTDOWN
Quote from: Kitty Hello on 2011-Jan-20
right. Something like:
SOCK_INIT
sock% = SOCK_TCP_CONENCT("www.google.com", 80)
IF sock>0 THEN bInternet=TRUE // check return value. Is it 0 or -1 on error?
SOCK_CLOSE(sock)
SOCK_SHUTDOWN
But what if google.com goes down? just kidding.
Works perfect, thanks.
QuoteBut what if google.com goes down? just kidding.
Would be best to check against three or so different addresses
-google
-microsoft
-glbasic
- the big 3 :D
How can you not put GLBasic first Gernot? :P :D