I need a way to have an event fire when a desktop app is online/offline, is their anything in Xojo that would tell me this or some other way of knowing?
The easiest way is to periodically check if you can reach a few websites. For instance,
api.ipify.org
www.example.com
My preferred way is to use the HTTPSocket.GetHeader method. As long as the result is Nil, you’re offline. To be on the safe side, I usually do this with two different websites.
from : https://forum.xojo.com/36891-best-way-to-determine-internet-connection-vote-advice
Public Function IsInternetConnected() as Boolean
' checks if internet is connected by checking the connection to google,apple and microsoft
' fastest way found today
' see https://forum.xojo.com/36891-best-way-to-determine-internet-connection-vote-advice
Dim http As New TCPSocket
http.Address = "www.apple.com"
http.port = 80
http.Connect
dim okapple as Boolean = (http.LastErrorCode = 0)
http.close
http.Address = "www.google.com"
http.Connect
dim okgoogle as Boolean = (http.LastErrorCode = 0)
http.close
http.Address = "www.microsoft.com"
http.Connect
dim okmicrosoft as Boolean = (http.LastErrorCode = 0)
http.close
Return okapple and okgoogle and okmicrosoft
End Function
Thanks everyone