Well, there really are many other technologies to use, for example JMS has various implementations that work out of the box.
Sockets are low-level building blocks of network communications, such as wires in the electrical network of your home. Yes, they are old-fashioned, yes, we probably do not want to see them, but they are there, and they will stay there for a good reason.
At the top of the sockets, for example, select HTTPUrlConnection, which implements most of the HTTP protocol. However, setting timeout policies is in your hands, which I find very useful and extremely painful at the same time.
http://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/
You can move one level of abstraction higher and use a ready-made REST library, such as: http://unirest.io/java.html p>
The above example connects to the server, configures the HTTP request string, executes the request (timeout, encodings, all the clutter under the hood) and finally receives a Json response in several lines:
Unirest.post("http://httpbin.org/post") .queryString("name", "Mark") .field("last", "Polo") .asJson();
Currently, a huge number of web services are available using the REST protocol, which is a simple HTTP command response. If you have a chance, I would suggest using REST, as you can easily find the available implementations on the client side and on the server, and you do not need to reinvent the wheel at the command protocol level.
On the client side, unirest is pretty convenient. On the server side, we had a really great experience in the 1.2.xx game series! framework But there are thousands of these things, just find "REST".