Try using P/Invoke to call InternetGetConnectedState. That should tell you whether or not you have a connection configured. You can then try checking the specific connection to your service using InternetCheckConnection. This is (sometimes) quicker than hooking up the connection directly, but I’d test it to see if it’s any better than just doing a full connection up front.
Related Contents:
- How to provide user name and password when connecting to a network share
- An existing connection was forcibly closed by the remote host
- Get local IP address
- Programming P2P application
- Get public/external IP address?
- How can you change Network settings (IP Address, DNS, WINS, Host Name) with code in C#
- How to write a scalable TCP/IP based server
- How do I check for a network connection?
- Accessing Password Protected Network Drives in Windows in C#?
- How to set the timeout for a TcpClient?
- Easiest way to read from a URL into a string in .NET
- UnityWebRequest Embedding User + Password data for HTTP Basic Authentication not working on Android
- Detecting network connection speed and bandwidth usage in C#
- Receiving data in TCP
- Async network operations never finish
- TraceRoute and Ping in C#
- How do I get the available wifi APs and their signal strength in .net?
- Find the next TCP port in .NET
- Why does my .NET application crash when run from a network drive?
- Identifying active network interface
- How to get *internet* IP?
- Get All IP Addresses on Machine
- C# Begin/EndReceive – how do I read large data?
- Proper way to stop TcpListener
- A call to SSPI failed, see inner exception – The Local Security Authority cannot be contacted
- Anyone know a good workaround for the lack of an enum generic constraint?
- WPF Binding UI events to commands in ViewModel
- Is using a ‘goto’ statement bad?
- Cast to Anonymous Type
- How do I round to the nearest 0.5?
- What does $ mean before a string?
- How to call a C# library from Native C++ (using C++\CLI and IJW)
- Execute specified function every X seconds
- No templates in Visual Studio 2017
- Error: “The specified LINQ expression contains references to queries that are associated with different contexts”
- What’s better: DataSet or DataReader?
- BigInteger to Hex/Decimal/Octal/Binary strings?
- How to find default web browser using C#?
- Generic method multiple (OR) type constraint
- CallbackOnCollectedDelegate in globalKeyboardHook was detected
- Calculate the display width of a string in C#?
- Cannot deserialize the current JSON array (e.g. [1,2,3]) into type
- ASP.NET MVC Dropdown List From SelectList
- I want to understand the lambda expression in @Html.DisplayFor(modelItem => item.FirstName)
- What is the difference between IEnumerator and IEnumerable? [duplicate]
- Entity Framework – Add Navigation Property Manually
- Compare RGB colors in c#
- MS Chart Control Two Y Axis
- Accessing properties with a dot in their name
- An error occurred attempting to determine the process id of the DNX process hosting your application