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