- Joined
- May 16, 2011
- Messages
- 650
- Reaction score
- 327
Hi,
I have a server and client both written in C# WPF, using NET 4.0.
I'm trying to build a command structure to communicate between the client and server.
So far I'm using a basic string-based command structure, and I'm having a hard time making it work with the server.
The server receives a string command(ex: "REQUEST_ONLINEUSERS") from the client and sends the response back containing the data requested.
However, I'm having a hard time filtering multiple commands on the server. The command is converted to a byte array, then sent to the server. The server then reads the data and converts it back to a string. I then search for a specific ending tag, if it exists, it checks if it's a command by comparing the string.
This works and I can filter different commands, but I don't feel this is efficient and could cause problems later down the road. Is there a better way of identify commands from the client?
I have a server and client both written in C# WPF, using NET 4.0.
I'm trying to build a command structure to communicate between the client and server.
So far I'm using a basic string-based command structure, and I'm having a hard time making it work with the server.
The server receives a string command(ex: "REQUEST_ONLINEUSERS") from the client and sends the response back containing the data requested.
However, I'm having a hard time filtering multiple commands on the server. The command is converted to a byte array, then sent to the server. The server then reads the data and converts it back to a string. I then search for a specific ending tag, if it exists, it checks if it's a command by comparing the string.
This works and I can filter different commands, but I don't feel this is efficient and could cause problems later down the road. Is there a better way of identify commands from the client?