DECLARE INTEGER InternetCheckConnection IN wininet;
STRING lpszUrl,;
INTEGER dwFlags,;
INTEGER dwReserved
IF InternetCheckConnection("http://www.yahoo.com", 1, 0) == 1
RETURN .T.
ELSE
RETURN .F.
ENDIF
But found that, while this worked much of the time, there was one instance - one computer installation - in which it did not. I have a Foxpro application that is installed on a server and at some 15 remote sites that use a variety of Internet connections, from air-cards to wifi to NIC. I wanted a simple test that I could use right up-front, rather than waiting until I had assembled a whole bunch of stuff, for example, to FTP only to then find that no connection was available. Since the winiNet approach didn't work, I upgraded to the current version of WW Client Tools and tried using HTTPPing. Unfortunately, I got the same result. Here's what the code looks like:
#DEFINE CRLF CHR(13)+CHR(10)
oIP = CREATEOBJECT("wwHttp")
*** Optionally - set any oIP Connection options
*!* oIP.cUsername = "ricks"
*!* oIP.cPassword = "supersecret"
IF !oIP.HTTPPing(25,"http://www.yahoo.com")
MessageBox("No Connection" + CRLF + CRLF + ;
"Error[" + ALLTRIM(STR(oIP.nError)) + "]" + CRLF + ;
"[" + oIP.cErrorMsg + "]")
RELEASE oIP
RETURN .F.
ENDIF
MESSAGEBOX("Connected.")
RELEASE oIP
RETURN .T.
I connected to one of the remote systems using GoToMyPC and downloaded the app that contains this code. Obviously there was an Internet connection - I was on-line with the remote computer but, even so, when I ran the above code I got the following error:
No Connection
Error [12029]
[A connection with the server could not be established]
The network adapter is an Intel 82566DB-2 Gigabit Network Connection
If I open a command prompt and PING www.yahoo.com, I get the normal replies.
Again, this function works on most computers but not this particular one. I've searched for error 12029 and see a variety of resolution ideas but none that seem relevant here. For example, there is no firewall in effect and other Internet functions (browsing, etc.) seem Ok. I'd appreciate any suggestions you might have, including any additional information that I might want to gather that would make troubleshooting this problem easier.
Thanks