Hi.
There is an client-server application. For example, a client sends server a packet like this:
<byte of beginning of the string> + <command> + <the name of the user who sends> + <the name of the user who receives> + <message> + <byte of ending of the string>
How can I split this packet onto <command>, <the name of the user who sends>, <the name of the user who receives>, <message> separately? Can I use wxstringtokenizer or are there the other methods?
Thank you.
wxsocket packet
Re: wxsocket packet
The the whole string is under your control, you can do what you like. E.g. if you know for sure that the character '$' never appears anywhere else in the string, you could use it as a separator. Or you could url-encode the string, or, or, or. There are hundreds of options, wxStringTokenizer is one of them.
Use the source, Luke!