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