Best way to transfer mixed unicode and single byte characters over boost::asio
We're trying to use winapi widestring functions to retrieve registry information. We then need to transfer that information across the network.
LPWSTR PerfData = (LPWSTR) malloc(8192);
RegQueryValueEx(hSubKey, TEXT("DisplayName"), NULL, NULL, (LPBYTE) PerfData, &cbData);
Now that we have the w开发者_开发技巧idestring characters we will be padding them with xml in single byte characters. It is important to save as much bandwidth as possible because as this iterates over thousands of computers it already clogged our network when we were using the single bytes.
Also, how am I going to separate these on the other side?
The cheapest (in terms of bandwidth) protocol I've used so far was Google's protobuf. I strongly recommend it. As for boost-asio, it's not causing any overhead - asio is a good choice. You can also consider compressing it (use boost iostreams gzip filter with asio).
精彩评论