Hoping someone can shed some light on this. 

I have a PHP program which opens a port and sends some text to a java program listening on that port. Basically, there could be many instances of this PHP program connecting over this port to this one java program. The java program contacts an API, retrieves the answer, and then sends the information back over the port to the PHP program. 

This solution seems to work but sometimes I get a empty response in my PHP program. The java program runs run successfully but the answer string is not transmitted back through the port to the php program.

Does this solution sound valid? Will I ever have an instance where the java program will send back the wrong information to the PHP program? Can anyone see any problems here? Thanks a bunch!