Le réseau pour les développeurs >
Forums - Accueil
>
Visual C# Language
>
Notify instead of Monitor Internet Connection Status
Notify instead of Monitor Internet Connection Status
- Hi
Some one please help me on how to monitor internet connection status. wheather is available or not.
I have searched on this didn't find
what i found is
1. NetworkChange.NetworkAvailabilityChanged event
but this will only detect the network availability. I want a notification similar to this for internet connection availability. If there is network and only internet is gone then this will fail.
2. Using a function to detect internet connection status (got several such function)
this will work fine. but i have to put this in a thread to check condinously. Is that is the only way or is there any other way to get notification or will call event handler function like the previous. I think their will be one.
or some body can tell where the windows will make entry in the registry for internet connection status. I know to make notification for a specific key on registry. Which if changes will call the notify-function.
Please help me on how the internet related program (like messengers) are notified at the instance the internet is disconnected
Thanks in Advance
Akeeq- ModifiéAkeeq jeudi 5 novembre 2009 11:31more undestood
Réponses
- Hi Akeeq,
As mentioned at the link below you can do it with a timer.
http://www.c-sharpcorner.com/UploadFile/scottlysle/ConnectionState02092007002552AM/ConnectionState.aspx- Marqué comme réponseAkeeq mercredi 11 novembre 2009 10:51
- Hi,
As far as I can see, this kind of event does not exist.
We might need to query every time using timer.
I believe messagers get notifications when they sent information but do not get response. They will not receive notification when the internet status is changed.
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marqué comme réponseAkeeq mercredi 11 novembre 2009 10:50
Toutes les réponses
Hi,
When programs such as messenger could not establish connection to their server they go into disconnected state.
You can do the similar.
You can ping a server at specific time intervalsSystem.Net.NetworkInformation.Ping png = new System.Net.NetworkInformation.Ping(); try { PingReply rply = png.Send("www.bing.com"); Console.Write(rply.RoundtripTime.ToString()); Console.ReadLine(); } catch (Exception) { Console.Write("Ping Error"); Console.ReadLine(); }
Note:Using ip address instead of using domain might be a better way to prevent errors related to DNS.- Hi
Any one know how to create WMI internet connection notification function.
i dont like to create thread or any timer which will consume CPU and memory
but if that is the only way then please tell how it can impliment effectively.
Thanks - Hi,
Did some research and found that you can get this information with an api.
Here is a sample.
[DllImport("wininet.dll")] private extern static bool InternetGetConnectedState(out int Description, int ReservedValue); public static bool IsInternetConnectionAvailable() { int d; return InternetGetConnectedState(out d, 0); } static void Main() { Console.WriteLine(IsInternetConnectionAvailable()); Console.ReadKey(); }- Proposé comme réponseTamer OzMVPvendredi 6 novembre 2009 12:11
- Hi
I know my English is poor. But now i realized how much deep it is
Please ...
i know how to get connection status
what i need is a call back or notification function when ever internet connection status changes
If their is no such thing, please tell that or how can i implement this
- Hi Akeeq,
As mentioned at the link below you can do it with a timer.
http://www.c-sharpcorner.com/UploadFile/scottlysle/ConnectionState02092007002552AM/ConnectionState.aspx- Marqué comme réponseAkeeq mercredi 11 novembre 2009 10:51
- Hi,
As far as I can see, this kind of event does not exist.
We might need to query every time using timer.
I believe messagers get notifications when they sent information but do not get response. They will not receive notification when the internet status is changed.
Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marqué comme réponseAkeeq mercredi 11 novembre 2009 10:50

