I'm programming a socket connection. Server and Client. Server waits for connection by socket.accept(); Then all incoming messages can be processed.
So far so good, but how can I control these messages? At the moment, I only see that eg the server expects a certain message, and the client has to send this message. This could be a String message.
But what if the client sends another message, eg an Integer? How can I make the server expect different messages? And based on the parameter type and parameter count, decide which method is to execute?
Or is a socket just for exchanging messages in a well known order between client and server?
Specially I'm looking for sth like to supply a eg processInteger and getString() method on server side. And if I send a message from client, based on these message I want to execute either or other method.
Can I somehow control this by the client to which method the message goes?