Java interface and bugfixes

Standardized the server to interface with a java client, fixed a major
bug in which multiple socket.send commands could be recieved
simultaneously by one socket.recieve command.