August 27th, 2012, 06:36 PM
Sending preformed UDP packets to localhost
Hoping to get some help from the experts here. I have a service, "Listener", that is listing on 0.0.0.0:7070. I have another application, "Agent" that receives fully-formed UDP/IP packets via a proprietary interface.
I would like to preserve the UDP/IP packet in its entirety (do not want to perform any NAT) and somehow get it from the Agent to the Listener.
Physical NIC with address 10.80.8.10 / 255.255.0.0
Microsoft Loopback Adapter with address 10.10.10.1 / 255.255.0.0
IP Forwarding enabled via Registry Edit (Windows XP / 7)
The IP packet that the Agent has received is addressed to 10.10.10.1:7070 (Virtual NIC).
What I can get to work:
Using WinPcap and WinPcap::SendPacket, I can attach to the Physical NIC and send the packet to that NIC. The packet is then forwarded to the Virtual NIC (I assume) and received by the Listener.
Problem: My target system does not have a Physical NIC
I tried installing a 2nd Microsoft Loopback Adapter, mimicking the addresses of the Physical NIC, attaching WinPcap to the 2nd Loopback Adapter, and sending the packet to it, just like I did with the Physical NIC, and... nothing. I've also tried experimenting with sending it to a Raw Socket, with no results (not sure if I'm doing something wrong, have never used raw sockets before).
So, I'm hoping someone can point me in the right direction. End goal is to get the pre-formed packet from the Agent to the Listener, and I really don't care what the mechanism is (WinPcap, Raw Sockets, something simple I'm too ignorant to know about, anything else), so long as the Listener receives the packet and the IP/UDP headers and Data payload are unmolested.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.