Redirecting traffic to eth0/eth1
This is more of a network programming question, but I couldnt find the appropriate forum.
I would like to send a packet, for now lets say a ping packet through a specific interface. I know that the ping program supports this. What I want to know is how to set it up in my own source code, so that I can send a packet through eth0 or eth1 depending on what my code chooses.
Do I set it up at the socket level, or when I'm assembling the packet header?
Currently I'm at a loss to find source code samples on the net.
Any help is appreciated, thanks.