Use of webrequest

During an idle state of my user interface (using Glide) I use a webrequest to send a status signal or heartbeat to a server via the internet. This works really well except for the case when the network cable is not plugged in or the server is unreachable. I have the webrequest routine wrapped in a try…catch and this handles the exception fine except that is takes over a minute for the exception to occur. Setting the timeout property of the webrequest to something shorter has no effect. I also have the webrequest in a different thread but it blocks the UI until the exception is caught. So my UI won’t accept any input until then which is a bit problematic. Is there any way to run the webrequest asynchronously? Or any other suggestions? The program can operate normally without internet access (it just won’t receive any updates), but it is still important to be keep trying to send the heartbeat signal.

Multi threading?

That is what I was thinking and what I did (or at least I thought). Below is the line of code that runs once the Glide window is created.

new Thread(HeartbeatMain).Start();

“HeartbeatMain” is what performs the webrequest.

Have you tried reading the Ethernet.IsCableConnected property before trying the request?

that worked. Thanks so much.