I’m currently writing a simple client/server in Java using sockets. I want the server to make decisions based on different “commands” and/or serialized objects that are received from the client via the socket, and vice-versa.
Something like:
[Receive Command 'DoSomething' From Client]
[Call Method 'DoSomething' on the Server]
[Send result/status to Client]
etc...
Is there a convention for flow control like this using ordinary socket communication, perhaps with serialization? Should I be using RMI in Java instead?
There is not. If you create client/server communication with sockets, you’ll have to define your own protocol and the rules that apply for that protocol.
RMI may ease this step by executing specific object methods. The trade of is, the initial setup for the rmi server etc. which I’ve heard in recent years is not that hard as it use to be.
Here’s a RMI tutorial you may find helpful