AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Funciones HTTP
  • Firewall
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
InternetConnected (Function)
Defines whether an Internet connection is enabled on the current computer.
Ejemplo
// Active Internet connection?
ResConnection = InternetConnected()
IF ResConnection = True THEN
Info("An Internet connection is enabled")
ELSE
Info("No Internet connection is enabled")
END
Sintaxis

Finding out whether an Internet connection is enabled Ocultar los detalles

<Result> = InternetConnected()
<Result>: Boolean
  • True if an Internet connection is enabled on the current computer,
  • False otherwise.
Observaciones
WINDEVCódigo de Usuario (UMC)

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.
Note: Ping is performed on Google DNS (6 seconds, 1 try). The equivalent code is:
Ping("8.8.8.8", 6000, 1)
Componente: wd300com.dll
Ver también
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
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 05 2023
** 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 12 2016

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local