Alberto
Alberto

Reputation: 359

Java. Communicate two peer-to-peer applications

I am studying communications in Java using RMI and in all the references that I find there is a client that makes calls to remote methods in a server. That is, all communications are initiated by the client.

If I wanted two computers to communicate as equals, would it be right for each of them to implement a remote object? That is, the two applications would play the role of client and server.

Thank you

Upvotes: 1

Views: 832

Answers (1)

Maciej Pulikowski
Maciej Pulikowski

Reputation: 2517

If you are creating desktop application, you could use sockets for communications between many computers.

A socket is one end-point of a two-way communication link between two or more programs running on the network. Socket classes are used to represent the connection between a client program and a server program. More.

Example code for server/client applications

You should know that you will need a bit of knowledge about concurrency and networking to create good communication between many computers. Creating simple server/client applications is very good way to achieve it :)

Please remember that client will always need IP:PORT address to connect to server.

Upvotes: 1

Related Questions