To improve error handling and speed I want to add a check for internet connection before logging into an Imap account.
I found some code on the forum:
dim theShell as new Shell
theShell.Execute "ping -n -q -W 5 -c 1 8.8.8.8"
If theShell.ExitCode = 0 Then Return True
This works fine except when Little Snitch is installed on the computer. The shell is too fast and just returns an error code.
I had the idea to make a loop and test for about 10 seconds so that the user can confirm the Little Snitch dialog.
Is there a better way to check for internet connection? Like using this here?
11 posts - 6 participants