Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I don't think there's any way to set the source port except with bind(). Why can't A send directly to B? Commented Jun 27, 2013 at 7:27
  • 1
    Oh, I get it. C is the server -- it does something with the message that A sends, but you want replies to go to B rather than A. But C doesn't know that it's talking to two different processes. Commented Jun 27, 2013 at 7:31
  • Yes. Thats exactly the problem. Commented Jun 27, 2013 at 7:40
  • If A and B are running on the same PC, then perhaps you can have A use a RAW socket instead of a UDP socket so that it can create the UDP header manually and forge the sender Port to match what B is listening on. Commented Jun 27, 2013 at 8:12
  • If you specify the IP_HDRINCL option on a RAW socket, then you can manually create the IP header as well, which should allow for forging the sender IP if A and B are not running on the same PC. Commented Jun 27, 2013 at 8:22