Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for internet connection via proxy
Message
From
16/03/2017 07:02:33
Antonio Lopes (Online)
BookMARC
Coimbra, Portugal
 
 
To
16/03/2017 05:30:30
General information
Forum:
Visual FoxPro
Category:
Internet applications
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01649101
Message ID:
01649103
Views:
63
>How can I check internet connection in LAN environment through proxy? I use code
>
>#DEFINE FLAG_ICC_FORCE_CONNECTION 1
>DECLARE Long InternetCheckConnection IN Wininet.dll String Url, Long dwFlags, Long Reserved
>
>lcUrl = "http://www.google.com"
>IF InternetCheckConnection(lcUrl, FLAG_ICC_FORCE_CONNECTION, 0) != 0
> ? "Connection is available"
>ELSE
> ? "No Connection"
>ENDIF
>
>and it allways returns "no connection" on PC with proxy. On PC without proxy everything works fine.
>
>Thanks in advance.

No proxy here to try, but you may look at other method of doing this.

For VFP6:
LOCAL Checker

m.Checker = CREATEOBJECT("NetConnection")

m.Checker.Test()

? IIF(m.Checker.Connected, "", "not ") + "connected"

DEFINE CLASS NetConnection AS Custom

	Connected = .F.
	
	FUNCTION Test
		LOCAL CheckConnection

		m.CheckConnection = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")

		This.Connected = .T.
		m.CheckConnection.Open("Head", "https://www.w3.org", .F.)
		m.CheckConnection.Send()
		m.CheckConnection.Waitforresponse(1)
	ENDFUNC

	FUNCTION Error
	LPARAMETERS ErrorNumber, MethodName, LineNumber
		This.Connected = .F.
	ENDFUNC

ENDDEFINE
----------------------------------
António Tavares Lopes
Previous
Reply
Map
View

Click here to load this message in the networking platform