开发者

Best way to transfer mixed unicode and single byte characters over boost::asio

开发者 https://www.devze.com 2023-04-07 10:17 出处:网络
We\'re trying to use winapi widestring functions to retrieve registry information.We then need to transfer that information across the network.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消