title: Alternative solution to sockets in Java
body: <p>I made an application in java between two machines where each one at the time makes some computation over some data and send to the other  to do its part. I managed to do it using sockets. Therefore, both machines play server and client depending on which part of the code they are running. However, it demands a lot of synchronization so that will have already the data to compute and so far I managed to do it with a <code>Thread.sleep();</code> but since I put a big margin for the sleep time, it results on a lot of idle time.
  I was wondering if there is any alternative to this so that I have automatic synchronization.</p>