internet-connection

Detect an internet connection activation with Delphi

霸气de小男生 提交于 2019-11-26 13:08:28
问题 I\'ve been using a 3G wireless card for a while and every time I connect, my anti-virus fires up the updates. I\'m wondering what is the Win32 API set of functions that I can use to, either, get notified or query about the event of an Internet Connection coming up? And is there already a set of ported headers for Delphi? 回答1: I worked on a project to run a user's logon script whenever they connected our network over VPN. To do this, I wrote a helper unit that retrieves adapter info and stores

Detect internet Connection using Java [duplicate]

牧云@^-^@ 提交于 2019-11-26 07:31:17
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to check if internet connection is present in java? I want to see if anyone has an easy way of detecting if there is an internet connection when using Java. The current app used the \"InternetGetConnectedState\" method in the WinInit DLL for windows, but my app needs to be cross-platform for mac operation and this way will not work. I do not know JNI at all either to use DLLs in Java and it became

Detect if Android device has Internet connection

夙愿已清 提交于 2019-11-26 03:15:01
问题 I need to tell if my device has Internet connection or not. I found many answers like: private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null; } (Taken from Detect whether there is an Internet connection available on Android.) But this is not right, for example if I\'m connected to a

What is the best way to check for Internet connectivity using .NET?

邮差的信 提交于 2019-11-26 01:25:36
问题 What is the fastest and most efficient way to check for Internet connectivity in .NET? 回答1: Something like this should work. System.Net.WebClient public static bool CheckForInternetConnection() { try { using (var client = new WebClient()) using (client.OpenRead("http://google.com/generate_204")) return true; } catch { return false; } } 回答2: There is absolutely no way you can reliably check if there is an internet connection or not (I assume you mean access to the internet). You can, however,

Easiest way to detect Internet connection on iOS?

一笑奈何 提交于 2019-11-26 00:50:01
问题 I know this question will appear to be a dupe of many others, however, I don\'t feel the simple case is well explained here. Coming from an Android and BlackBerry background, making requests through HTTPUrlConnection instantly fail if there is no connection available. This seems like completely sane behavior, and I was surprised to find NSURLConnection in iOS did not emulate it. I understand that Apple (and others who have extended it) provide a Reachability class to assist with determining

Check if Internet Connection Exists with Javascript? [duplicate]

白昼怎懂夜的黑 提交于 2019-11-25 22:59:40
问题 This question already has answers here : Detect the Internet connection is offline? (18 answers) Closed 5 years ago . How do you check if there is an internet connection using Javascript? That way I could have some conditionals saying \"use the google cached version of JQuery during production, use either that or a local version during development, depending on the internet connection\". 回答1: The best option for your specific case might be: Right before your close </body> tag: <script src=

Detect the Internet connection is offline?

不问归期 提交于 2019-11-25 22:27:42
问题 How to detect the Internet connection is offline in JavaScript? 回答1: You can determine that the connection is lost by making failed XHR requests . The standard approach is to retry the request a few times. If it doesn't go through, alert the user to check the connection, and fail gracefully . Sidenote: To put the entire application in an "offline" state may lead to a lot of error-prone work of handling state.. wireless connections may come and go, etc. So your best bet may be to just fail

Detect whether there is an Internet connection available on Android [duplicate]

六眼飞鱼酱① 提交于 2019-11-25 21:41:05
问题 I need to detect whether the Android device is connected to the Internet. The NetworkInfo class provides a non-static method isAvailable() that sounds perfect. Problem is that: NetworkInfo ni = new NetworkInfo(); if (!ni.isAvailable()) { // do something } throws this error: The constructor NetworkInfo is not visible. Safe bet is there is another class that returns a NetworkInfo object. But I don\'t know which. How to get the above snippet of code to work? How could I have found myself the