title: One socket or two for inter-process communication on single host
body: <p>If I want to use (UDP) sockets as an inter-process communication mechanism on a single PC, are there restrictions on what I can set up due to the two endpoints having the same IP address?</p>
  
  <p>I imagine that in order to have two processes <code>A</code> and <code>B</code> both listening on the same IP/port address, <code>SO_REUSADDR</code> would be necessary - correct? And even though that might conceptually allow for full duplex comms over a single socket, there are other questions I have if I try to go full duplex:</p>
  
  <ul>
  <li>would I end up receiving my own transmissions, and have to filter them out?</li>
  <li>would I be exposing myself to other processes injecting spurious or malicious data into my sockets due to the use of SO_REUSEADDR... or do I face this possibility simply by using (connectionless) UDP?</li>
  <li>how would things be different (in an addressing/security/restrictions sense) if I chose to use TCP instead?</li>
  </ul>
  
  <p>I'm confident that there is a viable solution using two sockets at each end (one for <code>A -&gt; B</code> data, one for <code>B -&gt;A</code> data)... but is there a viable solution using a single socket at each end? Would there be any clear advantages to using one full-duplex socket per process if it is possible?</p>