Better design to parse request/response in c++ socket client-server application

530 views Asked by At

I am developing a c++ client-server application using sockets. Client will send commands to server and server has to parse it and call appropriate module functions to process the request. At the client side, it has to parse the response and do some work based on that.

command format:

  • request commandname-command1, modulename-module1, params-{param1,param2,...paramN)
  • response commandname-command1, modulename-module1, status-success/failure, responsedata-data

Here I am writing parsing logic in both client and server to handle request/response commands. I found that parsing logic is almost similar in both client and sever. So I want to create some library to handle parsing and use that library in both client and server. Expecting better and well designed approach to handle this scenario. I am ready to change the command format if required.

0

There are 0 answers