I am new to SharpPcap and I am confused. How can I use it for enabling and disabling internet connection using C#, is there any built in functions for this purpose? Are there any tutorials available for SharpPcap?
Asked
Active
Viewed 724 times
1 Answers
3
SharpPcap, and the lower level libraries libpcap/winpcap, are designed to observe and capture network packets. They don't have the ability to alter packets before they are transmitted, or to block incoming packets (such as a firewall might do).
There may be a way to disable network adapters or networking via c#, a quick serach on google turned up this page, but this functionality isn't something SharpPcap or other capture libraries are involved in.

Chris Morgan
- 1,277
- 1
- 13
- 33
-
thankz for the answer disabling network adapter will block whole network connection but i want to disable internet only – May 12 '13 at 15:59
-
You'll have to clarify what that means. You want ipv4/ipv6 etc on the local network but you don't want the system to get out to the Internet? Maybe disable/alter the dns addresses. The machine would be unable to resolve addresses and the Internet would be effectively disabled. Otherwise, because the routing is happening outside of the pc itself, it isn't trivial to do what you are asking. A firewall setting that blocks all addresses but local ones might work as well. – Chris Morgan May 14 '13 at 16:20