开发者

how to break the internet connection with code?

hey i know that on some computers you can cut off the wifi with a buttion and i want to do that with my desktop but it's not wireless. is there a way to in code block my co开发者_开发问答mputer from the internet then unblock later. anyway i can do this?


Try to use WMI - Windows Management Instrumentation to disable network connections.

WMI is visual basic / scripting friendly COM-technology based API and doesn't provide greate abilities though. But hope it helps


One possibility would be to use IpReleaseAddress to cut the connection, and IpRenewAddress to re-start it. Another possibility would be to use SetIfEntry to disable/enable the network interface.


A rather brute force way on windows if you're getting your address via DHCP is to just make a call to ipconfig /release and ipconfig /renew when you want your access back.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜