| View previous topic :: View next topic |
| Author |
Message |
arcray Valued Contributor


Joined: 13 Jul 2001 Posts: 242 Location: Aude, France
|
Posted: Tue Nov 16, 2010 11:23 am Post subject: Best way to test for a live internet connection using VDS |
|
|
Can't think straight today!
What is the best way to test if an internet connection is present using VDS 6 and the VDSIPP.DLL, without using PING (it gets blocked a lot)
I was thinking of putting a tiny text file on a web server, and GETting it. If it failed then no connection...
BUT is there a better, quicker way?
Thanks in advance _________________ Andrew GRAY
If you don't know I am looking for work, I won't get the job.
andrewrcgray.com |
|
| Back to top |
|
 |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Tue Nov 16, 2010 2:46 pm Post subject: |
|
|
You dont have to use vdsipp.dll
On your web server have a file called: test.txt
Contents of test.txt
SERVER CONNECTION OK
| Code: |
list create,1
list loadfile,1,http://<website address>/location of test.txt
%%result = @text(1)
list close,1
if @equal(%%result,SERVER CONNECTION OK)
info Internet Connection OK
else
warn No Internet Connection
end
VDS6 Can load http files directly into a list ;-)
regards
Nathan
regards
|
|
|
| Back to top |
|
 |
arcray Valued Contributor


Joined: 13 Jul 2001 Posts: 242 Location: Aude, France
|
Posted: Tue Nov 16, 2010 4:42 pm Post subject: |
|
|
Excellent! Just what we needed!
Many Thanks _________________ Andrew GRAY
If you don't know I am looking for work, I won't get the job.
andrewrcgray.com |
|
| Back to top |
|
 |
arcray Valued Contributor


Joined: 13 Jul 2001 Posts: 242 Location: Aude, France
|
Posted: Tue Nov 16, 2010 5:05 pm Post subject: |
|
|
Although it does not work for me. I MUST be doing some thing wrong, but I cannot see what. The first IF @EQUAL does not work, nor the second and obviously the third does.
| Code: |
%%Connected =
LIST CREATE,10
LIST LOADFILE,10,http://gisfiles.co.uk/text.TXT
%X = @TEXT(10)
LIST CLOSE,10
%9 = @INPUT(TheTEXT,%X)
IF @EQUAL(%9,OK)
%%Connected = 1
ELSE
%%Connected =
END
IF @EQUAL(%X,"OK")
%%Connected = 1
ELSE
%%Connected =
END
IF @EQUAL(%X,%9)
%%Connected = 1
ELSE
%%Connected =
END
EXIT
|
But I have no idea what the problem is.
Stumped! _________________ Andrew GRAY
If you don't know I am looking for work, I won't get the job.
andrewrcgray.com |
|
| Back to top |
|
 |
Claz Newbie
Joined: 03 Jan 2009 Posts: 23 Location: The Netherlands
|
Posted: Tue Nov 16, 2010 6:38 pm Post subject: |
|
|
It seems that you have some artefacts like spaces in %X.
If you use %X = @trim(@TEXT(10)) then spaces are removed and I see only OK, instead of OK with a few tokens.
Hope this will help you.
Claz |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Nov 17, 2010 1:35 pm Post subject: |
|
|
How about something like:
| Code: |
%%Connected =
LIST CREATE,10
LIST LOADFILE,10,http://gisfiles.co.uk/text.TXT
IF @match(10,OK)
%%Connected = 1
ELSE
%%Connected =
END
LIST CLOSE,10
EXIT
|
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
arcray Valued Contributor


Joined: 13 Jul 2001 Posts: 242 Location: Aude, France
|
Posted: Wed Nov 17, 2010 2:53 pm Post subject: |
|
|
Thanks to All. Claz's suggestion worked and I have now incorporated this solution into my code.
Once again, Thanks _________________ Andrew GRAY
If you don't know I am looking for work, I won't get the job.
andrewrcgray.com |
|
| Back to top |
|
 |
bornsoft Contributor

Joined: 19 Feb 2009 Posts: 113 Location: Germany
|
Posted: Wed Nov 17, 2010 11:58 pm Post subject: |
|
|
Hi,
how about this one:
| Code: |
LOADLIB WININET.DLL
%R = @lib(WININET,InternetCheckConnectionA,bool:,STR:http://www.google.com,INT:1,INT:0)
FREELIB WININET.DLL
if %R
info Connected.
else
info Not connected.
end
|
|
|
| Back to top |
|
 |
|