问题描述
我正在做一个防火墙项目.到目前为止,我已经成功通过ip阻止了数据包,这是由Windows过滤平台完成的.但是我的客户不想阻止整个IP.他想阻止特定的URL.所以现在我需要捕获每个数据包并读取它.到目前为止,我可以通过C#raw socket做到这一点.但我不知道如何丢弃该特定数据包.请帮助我.
I am working on a firewall project. So far I succeed to block packets by ip basis which is I done by windows filtering platform. But my customer does not want to block the whole ip. He wants to block specific url. So now I need to capture each packet and read it. So far I can do that by C# raw socket. But I dont know how to drop that specific packet. Please help me out on that.
推荐答案
这对您有帮助吗?
http://www.osix.net/modules/article/?id=824
在本文中,作者以原始格式读取数据包,然后将其发送.我认为您可以以此为基础来做您想做的事.
In this article the author reads packets in raw format and then sends them on. I think you can probably use this as a basis for what you want to do.
这篇关于C#/C ++捕获本地计算机ip数据包并将其丢弃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!