使用C#/C ++,可以限制网络流量吗? [英] Using C#/C++, is it possible to limit network traffic?

查看:101
本文介绍了使用C#/C ++,可以限制网络流量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个家长监视/跟踪应用程序,该应用程序具有锁定所有Internet活动的功能.禁用网络适配器似乎是一个简单的解决方案,但是应用程序必须能够远程重新打开Internet,因此网络需要保持启用状态,并保持一定的限制.

I'm developing a parental monitoring/tracking application that has a feature to lock down all internet activity. While disabling the network adapter would seem like a simple solution, the application must have the ability to turn the internet back on remotely -- so the network needs to remain enabled, to a certain limit.

不幸的是,我还没有找到在实践中实现此目标的合适方法.如果没有此功能,该应用程序将被完全淹没.因此,我遇到了很大的障碍,并且愿意接受任何建议.

Unfortunately, I haven't found a suitable way to achieve this in practice. Without this feature, the application is pretty much dead in the water. So I've hit a huge road block, and I'm open to any suggestions.

对于我的应用程序,我需要满足两个要求:

With my application, I need to achieve two requirements:

  1. 丢弃所有互联网活动. 然后
  2. 仅将Internet活动打开到指定的端口和IP地址. (我的服务,将对其进行轮询)

简单的目标,对不对?最近没有那么多.

Simple goal, right? Not so much lately.

虽然我希望在C#中实现这一目标,但我理解这可能是一个长远目标,而且我愿意接受可通过我的应用程序称为资源的C ++解决方案.

While I am looking to achieve this in C#, I understand that may be a long-shot and I am open to C++ solutions that could be called as a resource through my application.

还请注意,由于此解决方案必须包含所有内容,因此我无法在用户的系统上安装任何第三方软件.

Also note, I cannot install any third-party software on the user's system, as this solution needs to be all-encompassing.

提前谢谢!

推荐答案

您需要使用

You need to inject a custom layer into the IP stack, using Windows Filtering Platform. This SDK targets specifically parental control programs and such. Needless to say, as any kernel module, it has to be developed in C and you must have expert knowledge of Windows internals:

Windows筛选平台API是 设计供程序员使用 C/C ++开发软件. 程序员应该熟悉 网络的概念与设计 使用用户模式的系统和 内核模式组件.

The Windows Filtering Platform API is designed for use by programmers using C/C++ development software. Programmers should be familiar with networking concepts and design of systems using user-mode and kernel-mode components.

这篇关于使用C#/C ++,可以限制网络流量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆