'
Wait For (Ping("translate.google.com", 443)) Complete (Result As Boolean)
Log(Result)
Wait For (Ping("google.com", 443)) Complete (Result As Boolean)
Log(Result)
Wait For (Ping("b4x.com", 443)) Complete (Result As Boolean)
Log(Result)
Wait For (Ping("b4xxxx.com", 443)) Complete (Result As Boolean)
Log(Result)
Wait For (Ping("noooooooone.com", 443)) Complete (Result As Boolean)
Log(Result)
B4X:
Public Sub Ping(Host As String, Port As Int) As ResumableSub
Dim Socket As Socket
Try
Socket.Initialize("Socket")
Socket.Connect(Host, Port, 60 * DateTime.TicksPerSecond)
Wait For Socket_Connected (Successful As Boolean)
Catch
Log(LastException)
End Try
Return Successful
End Sub