On Windows XP, we would like an application to be able to send UDP packets "from" arbitrary IP4 addresses onto a [private] network that's connected to one of the computer's network cards. The receiving 开发者_JAVA百科computer should believe that the packets originated from different devices.
Obviously socket.sendto()
will just create packets that inherit the network card's IP address. But what additional hardware (or network-card configuration) is needed to make this work?
RAW sockets or RAW Ethernet sockets are likely the best solution. You can get a NDIS driver for RAW Ethernet sockets and then exercise in C or .Net as required.
http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms740463(v=vs.85).aspx
RAW Ethernet means you will need to construct the Ethernet, IP, and UDP headers for each packet.
http://www.rawether.net/
http://www.codeproject.com/KB/IP/sendrawpacket.aspx
http://msdn.microsoft.com/en-us/library/ff563732(v=vs.85).aspx
精彩评论