D
D
Denis Bondarenko2018-08-03 01:12:46
Java
Denis Bondarenko, 2018-08-03 01:12:46

How to implement communication between two or more computers in java?

Hello, how to implement communication between two or more computers? I read that you need to use sockets, but maybe there is another option? Previously, I only made web applications and did not encounter this.
The bottom line is that on each computer the application will process information and transfer it to the "main" computer. Can this be done in spring, for example?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gornostaev, 2018-08-03
@sergey-gornostaev

There are dozens of ways in hundreds of combinations. You should start by studying the standard ones - RMI and JMS.

A
Alexey Cheremisin, 2018-08-03
@leahch

The easiest way is to use a simple web server on the main . Clients will take information from the main via REST/json , and process it, send the results also via REST.
More complex is to use a message queue like RabbitMQ , ZeroMQ or Redis in a simple case.
If you need to transfer data between clients directly, look towards kryonet.
Well, you can install hazelcast or apache ignite and solve several problems at once, both with queues, and with distributed tasks, and with orchestration.
More advanced techniques take us back to hadoop/apache spark .
In this vein, I do not recommend using RMI at all (well, you can do a couple of examples for self-education), but take a look at JMX , you will need it.

A
Andrey K, 2018-08-03
@kuftachev

Java RMI or json/XML serialization.

O
Odissey Nemo, 2018-08-09
@odissey_nemo

If there is a common database, then it is quite simple to implement receiving and processing through it. With exclusive data capture, data transfer, synchronization, etc. DBs support it all. And no sockets, that's a plus. Only access to the database, which, of course, also needs to be administered. But this is inevitable and does not give additional time costs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question