首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

windows下发送自定义ip包的有关问题

2012-01-10 
windows下发送自定义ip包的问题一般来说:“自定义IP头是通过使用socket的库函数setsockopt()的选项IP_HDRIN

windows下发送自定义ip包的问题
一般来说:“自定义IP头是通过使用socket的库函数setsockopt()的选项IP_HDRINCL来实现的”,但是由于Winsock1.1和Winsock2.0函数库里setsockopt()不支持IP_HDRINCL选项,而windows   xp   sp2以后又检查了源地址源端口等信息,使得这种方法十分不好用,问一下大家,有什么好办法使得各种windows版本下都能够实现发包没有?请大家指教(隐约感觉驱动应该可以,但是没有做过,怎么入手,请指教)

[解决办法]
可以自己模拟一个网卡出来发包
[解决办法]
不需要驱动~
使用raw socket,lz google一下吧
[解决办法]
http://dev.csdn.net/article/1/1784.shtm
[解决办法]
微软的DDK里面有一个叫做 NDISPORT的示例
可以满足你的要求
下面是官方介绍
NDIS connection-less protocol driver sample
SUMMARY

This sample demonstrates a connection-less NDIS 5.0/5.1 protocol driver. The driver supports sending and receiving raw Ethernet frames using ReadFile/WriteFile calls from user-mode. As an NDIS protocol, it illustrates how to establish and tear down bindings to Ethernet adapters, i.e. those that export medium type NdisMedium802_3. It shows how to set a packet filter, send and receive data, and handle plug-and-play events. It also shows use of the following NDIS 5.1 features/APIs:

1. Canceling sends

2. NdisQueryPendingIOCount()

The sample works on Windows 2000, Windows XP, and Windows Server 2003 32-bit and 64-bit platforms.

这个驱动你完全可以直接用
不必作任何改动,自己把 Ring 3 部分改改就行了
很简单
呵呵

热点排行