title: How to implement a bidirectional "mailbox service" over tcp?
body: <p>The idea is to allow to peer processes to exchange messages (packets) over tcp as much asynchronously as possible.</p>
  
  <p>The way I'd like it to work is each process to have an outbox and an inbox. The send operation is just a push on the outbox. The receive operation is just a pop on the inbox. Underlying protocol would take care of the communication details.</p>
  
  <p>Is there a way to implement such mechanism using a <b>single TCP connection</b>?</p>
  
  <p>How would that be implemented using BSD sockets and modern OO Socket APIs (like Java or C# socket API)?</p>