endpoint:描述socket编程体系下的一个端点。一个IP+PORT ?
port还是一样的unsigned short
提供一个data()方法,来返回原生的地址结构体。这是一个好的思路,这样系统就不会封闭了。
address: 抽象的一个IP地址,可以是ipv4、ipv6。对外接口一致。具体实现上,是聚合了4和6两个实体。所以提供is_v4 is_v6这样两个函数来确认类型。
address只提供string到address的转换和构造。具体到address_v6 address_v4以后有提供long到address_v4的转换同时也提供了一系列的帮助函数:
/// Determine whether the address is a loopback address.
BOOST_ASIO_DECL bool is_loopback() const;
/// Determine whether the address is unspecified.
BOOST_ASIO_DECL bool is_unspecified() const;
/// Determine whether the address is a class A address.
BOOST_ASIO_DECL bool is_class_a() const;
/// Determine whether the address is a class B address.
BOOST_ASIO_DECL bool is_class_b() const;
/// Determine whether the address is a class C address.
BOOST_ASIO_DECL bool is_class_c() const;
/// Determine whether the address is a multicast address.
BOOST_ASIO_DECL bool is_multicast() const;
/// Obtain an address object that represents the loopback address.
static address_v4 loopback()
/// Obtain an address object that represents the broadcast address.
static address_v4 broadcast()