Capturing network status change event

后端 未结 4 1574
故里飘歌
故里飘歌 2021-01-20 19:50

I am trying to get events when the internet connection is reestablished after it is lost. It is for a data transfer software that I am developing. If I lose the network duri

4条回答
  •  盖世英雄少女心
    2021-01-20 20:06

    You might want to check out the System Event Notification Server (SENS) API http://msdn.microsoft.com/en-us/library/cc185680(VS.85).aspx

    I have not actually used it, but it seems like it supplies the events your looking for.

    EDIT:

    WMI appears to have all the information you need about various network connectivity and state changes. It also has an asynchronous event model that can be used to get notifications. The trick is, i suppose, generating the proper WMI query to get the information you want. This blog looks like the right type of query, and this MSDN explains how to handle the events asynchronously.

提交回复
热议问题