How to parse and handle messages on winsock server

Say I have client X passing Y message to Z winsock server.
I am trying to make a RAT for educational purposes, and the client must be able to send messages to server.exe to say open a random messagebox or start keylogging, etc.

How do you guys think I should parse messages?

Heres what Im thinking about doing:

The server listens and accepts, then recvs a message from the client. The client sends some message that is easy to distinguish like OPEN_MSGBOX or uses integer numbers to signify what the server must do.

After that im gonna use a switch statement to see which server.exe function the message matches it to, and then begin a new thread for that particular action.

My question is, what would be a good way to handle a char string with a switch statement? Recv only lets you recieve char[]s, so would i do something like:

if recv_server_reply_string == "OPEN_MSGBOX{

start_my_MSGBOX thread


or this:


case "OPEN_MSGBOX:{ start_my_msgbox thread}

default: break;


Just need some tips thats all. Thank you guys =)

help guys. How can i parse a message to my server to be processed?
Switch statement doesnt work with char arrays....
All these issues have been addressed before. You just need to search the forum. For example:
... and lots more going back years.
Topic archived. No new replies allowed.