boost 是否有使用 ntohl/htonl/ntohs/htons 类型函数的便携方式? [英] Does boost have portable way to use ntohl/htonl/ntohs/htons type functions?

查看:30
本文介绍了boost 是否有使用 ntohl/htonl/ntohs/htons 类型函数的便携方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有帮助,我正在使用 UDP,特别是 boost::asio::ip::udp::socket 套接字?

I am using UDP in particular boost::asio::ip::udp::socket sockets if that helps?

什么是头文件?

在 boost 下使用 UDP 处理网络字节排序需要哪些标头/类?

What headers/classes do I need to handle network byte ordering with the UDP under boost?

推荐答案

刚刚发现 #include <boost/asio.hpp> 就足够了,因为这会引入所有平台相关的标头和提供对 htonl/ntohl 的访问权限,这正是我所需要的.

Just found it is enough to #include <boost/asio.hpp> as this pulls in all the platform dependent headers and gives access to htonl/ntohl which is exactly what I need.

感谢大家的建议.

这篇关于boost 是否有使用 ntohl/htonl/ntohs/htons 类型函数的便携方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆