Hello, i am new in the socket programming in C/C++. I wrote Client and Server Socket. They can send and receive string. The idea is to send the commands to the server in the string. It can look something like this : "GET X" or "SET X 2". I know how i can split string. and the program know that the first word in the string is command, the second is attribute, and the third can be a value in case of SET-Command. My question is how i can say to programm that if it gets the string "GET X" it should call the function get(attribute). I thought the first about switch-case, but i think it's not a best solution for it. In case if it will be a lot of commands. THank you
Do you know how to use function pointers? You would still need some kind of "if(...)" test to match the string to the function but this would be a fairly modular way to do this.