I am working on a offline mode for a project in C#.
After disconnecting from internet also VPN Client is being alive for sometime for reconnecting attempt. In this situation all c# method says "Internet Connectivity State as True". This is a bug.
I am using the below method to detect whether i am offline or not.
bool isConnected = System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
The above method is giving status as True when I disconnect from internet and vpn client try to re-connect the server. Normally VPN Connectivity is not going to offline immediately after internet disconnects. VPN Client is taking extra 1 minute to change it status to fully offline. It tries to reconnect to establish a new connection in this time. In between, this 1 minute the above method gives InterConnectivity value as true. But this should give status as false. What is the best method or property to get the correct internet state on this situation?
No comments:
Post a Comment