Connecting 3 machines through Sockets and ServerSockets
I need to connect 3 machines which will be running a Java program and each will be assigned Process ID as P0, P1 or P2 such that
1. P0 starts and waits for other machines to connect to it
2. P1 starts and connects to P0
3. P2 starts and connects to both P1 and P0
After that these 3 machines will exchange messages between each other. I am not clear as to whether I should create both client Sockets and ServerSockets on all the 3 machines and how to connect them.
For machine P0, should I create client Socket ? With which machine should I connect it as it needs to read from both P1 and P2. Can someone help me with design. Each machine has to act as client as well as server.
Thanks and Regards