Ping a server to indicate whether it is up or down, or if it is a valid server.
Regards.
B4X:
Dim Ping As B4XPing
Ping.Initialize
Ping.TimeOut = 30 * DateTime.TicksPerSecond 'default 60 seconds
Ping.ListPorts = CreateMap("http":80, "https":443) 'default "http":80, "https":443, "ftp":21
Ping.DefaultPort = 443 'Default 80
Log("********** URL True **********")
Dim URL As String = "https://translate.google.com/?sl=auto&tl=es&op=translate"
Wait For (Ping.Server(URL)) Complete (Result As Boolean)
Log(URL)
Log(Result)
Dim URL As String = "b4x.com" 'DefaultPort
Wait For (Ping.Server(URL)) Complete (Result As Boolean)
Log(URL)
Log(Result)
Log("********** URL False **********")
Dim URL As String = "https://translate.googlexxxx.com/?sl=auto&tl=es&op=translate"
Wait For (Ping.Server(URL)) Complete (Result As Boolean)
Log(URL)
Log(Result)
Dim URL As String ="b4xxxx.com" 'DefaultPort
Wait For (Ping.Server(URL)) Complete (Result As Boolean)
Log(URL)
Log(Result)
Regards.
Last edited: