void ServerMainLoop () { // Keep responding to messages for ever. while (true) { // Wait for client request. Message callRequest = Message.receive (); // Figure out what function is called. String function = callRequest.getString (); // The rest of message processing depends on function. if (function.equals ("SomeServerFunction") { SomeParameterTypes parameters = callRequest.getSomeParameterTypes (); SomeReturnType result = SomeServerFunction (parameters); // Create a message that describes the result. Message callResponse = new Message (); callResponse.putSomeReturnType (result); // Send the response to the client. callResponse.send (ClientAddress); } else ... } }
Where does the function implementation come from ?
Where does the client address come from ?
What if there are multiple clients ?
What if the function fails ?