Reputation: 546
I want to route packets sended from my application to another gateway but i don't know what options i must change via setsockopt. I can't just add entries to routing table for specific hosts because second application also must connect to these hosts but via default gateway. Gateways have different public IPs. I found topic about set "source routing" options via IP_OPTIONS socket option (though without format), but as i understand this option only for routers not for my network adapter. Also i cannot add second adapter and connect it to same LAN.
Any suggestions how i can send packets on per application basis? May be routing API
P.S.: Windows versions are 32-bit XP SP3, 32- and 64 bit Windows 7 and one 64-bit Windows Server 2008 R2.
Upvotes: 1
Views: 570
Reputation: 8421
Short answer : this is really hard, are you sure you want to do it ? It is not possible directly via set sock opt. Most probably there are easier choices by adding routes manually with the command line utility "route". That will the best choice if your final destination is a known IP or network and that normal traffic can be routed through the other gateway as well.
Longer answer : if you are a code ninja, you have the following two options, good luck, I have no idea whether that will work in practice:
Upvotes: 2