title: What is the most efficient and best way to implement a bidirectional communication system using Java?
body: <p>My problem is the following, I have two servers from which I have to transfer files, in both directions. The transfer is triggered by a file creation event (on respective sides). The problem is one server has a public IP, the other one doesn't. </p>
  
  <p>I have implemented a socket client that sends a file over a socket, and a socket server which receives and saves it. (Working part)</p>
  
  <p>My questions are :  How to keep the socket 'alive' and send some data to the client after a file-system event occured on the server-side ? (Can the server call the client without knowing it's public IP ?)</p>
  
  <p>Can I achieve this with socket technology or should I go for something else like RMI ?</p>