开发者

WinService, startup and network

开发者 https://www.devze.com 2022-12-23 06:58 出处:网络
I\'m writing in .NET a windows service that, at windows startup, executes some network operations. I n开发者_StackOverflowoticed that my service starts before the network is up.

I'm writing in .NET a windows service that, at windows startup, executes some network operations. I n开发者_StackOverflowoticed that my service starts before the network is up. How can I check the network connectivity? Or, better, how can I check if the dhcp gave me an ip?


Here's a CodeProject article describing one method to detect the network status, including tracking when the network availability changes.

It is built on top of the framework's NetworkInterface.GetIsNetworkAvailable() method and the NetworkChange class.

0

精彩评论

暂无评论...
验证码 换一张
取 消