I am brand new to socket programming.
High Level Goal:
I am building software for software developement. It will consist of a server that runs the object model and an editor( client ) that allows for the development of the object model. software clients using the object model will come much later.
Communication:
I have a simple server and can access the server from the terminal. What I need to know is the best way to communicate the client actions to the server. I have not developed the client yet but I want to think about the communication now. For example if I create a new object in the editor, then I need to communicate this to the server where the object model resides. The server contains the classes methods etc to do this. I can already do it all in a main method.
Ultimately, I could send text to the server and have a structure of commands that translate into the server performing a specific action, like creating an object type. When thinking about this I immediately envision a nasty set of if else if statements for all the command possibilities need when reading a string over the socket communication. I have literally no experience in this area and my research( which I am probably asking incorrectly ) keeps bringing me to socket information. I have sockets setup now I want to now best implementation practices for the communication over sockets. I am sure there are standards out there.
Question:
I can't imagine that this is the best way to communicate with a java server of sockets( string inputs being parsed for commands ). I do not know much about encoders, decoders etc. but I assume that this problem has been solved before without the nasty if else if for figuring out what command the client is attempting. What is the best scalable way to achieve this communication?
Architecture is what I am asking. I want to do the research on my own but my searches are coming up empty handed. Is there any specific terminology I should be researching relation to the architecture for the communication? I searched the following( again I am probably using the wrong keywords ):
"communication standards over sockets java"
"implementing communication protocol for sockets java"
"binary communication standards over sockets java"
Example:
I am using Key(POJO) objects to implement object types, attributes, instances, relations and methods. So if I performed an action to create a new method on type Company I would need the following information for the server to process this request:
NewMethod(command), object type's Key, Name, body, boolean settings, arguments[], return type Key
given this structure I could have hundreds of commands so there would be a ton of string parsing.
I found my answer - Working from a TCP socket the communication between a client and server needs to then be defined. The sky is the limit. What I was interested in what some methods of defining this communication.
I found a SOF Question where someone was asking a very similar question.
In the end you create a packet definition protocol. For example the data can have the following pattern:
[command:arguments[] ]
Please see the link for the example explained.
EDIT:
Something else that I found that relates to what I was looking is called protocol buffers. Google came up with a good solution for this. It addresses the exact problem I was asking about. Again I think I did not know enough about the subject matter to use the right terminology nor did I describe it well enough for others to properly answer the question. Hopefully this helps others in the same situation.