ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / HTTP functions
  • Firewall
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
InternetConnected (Function)
In french: InternetConnecté
Defines whether an Internet connection is enabled on the current computer.
Example
// Active Internet connection?
ResConnection = InternetConnected()
IF ResConnection = True THEN
Info("An Internet connection is enabled")
ELSE
Info("No Internet connection is enabled")
END
Syntax

Finding out whether an Internet connection is enabled Hide the details

<Result> = InternetConnected()
<Result>: Boolean
  • True if an Internet connection is enabled on the current computer,
  • False otherwise.
Remarks
Reports and Queries

Firewall

InternetConnected uses a ping request to check the Internet access. Therefore, the ping must be allowed by the security parameters of the network in order for the result of the function to be pertinent.
Remark: The ping is performed on the Google DNS (6 seconds, 1 attempt). The equivalent code is:
Ping("8.8.8.8", 6000, 1)
Component: wd290com.dll
See also
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo
sRetorno is string = ""

cMyRequest is httpRequest

IF InternetConnected() = False THEN

ToastDisplay("Sem conexão com a internet",toastShort,vaBottom,haCenter)

RETURN("OFF")

ELSE

cMyRequest.URL = URL_SISTEMA+REGRA_PING
cMyRequest.Timeout = 45s

cMyResponse is httpResponse = HTTPSend(cMyRequest)

IF cMyResponse.StatusCode = 200 THEN

//sRetorno = AnsiToUnicode(cMyResponse.Content)
sRetorno = UTF8ToAnsi(cMyResponse.Content)

RETURN(sRetorno)

ELSE

RETURN("NOK")

END

END
Boller
23 May 2023
CHECK INTERNET
https://youtu.be/LVQMglOruG4

// VERIFICA INTERNET
// CHECK INTERNET
// VÉRIFIER INTERNET

https://windevdesenvolvimento.blogspot.com/2019/01/dicas-1981-windev-mobile-certificado-13.html

bRESULTADO_CONEXAO is boolean=InternetConnected()
// VAMOS AGORA VERIFICAR O RESULTADO DA CONEXÃO
// LET'S CHECK THE CONNECTION RESULT NOW
// Vérifions le résultat de la connexion maintenant
IF bRESULTADO_CONEXAO=True THEN
Info("CONEXAO OK")
ELSE
Info("ERRO CONEXÃO")
END
amarildo
10 Jan. 2019
** Dica **
Cuidado, ao utilizar essa função, não é confiável para testar Internet. Usavamos em nosso ERP, porém aconteceu de parar nossa emissão de NFe devido a função retornar equivocadamente que não tinha Conexão de Internet na máquina.

Para testar Conexão de Internet recomendo utilizar, o Post do Adriano Boller:
http://forum.pcsoft.fr/fr-FR/pcsoft.us.windevmobile/605-conexao-internet/read.awp
Danilo
22 Dec. 2016

Last update: 05/26/2022

Send a report | Local help