示例#1
0
std::string rev_order_av4_str(const boost::asio::ip::address_v4& a, const std::string& d)
{
    return str(boost::format("%1%.%2%.%3%.%4%.%5%")
            % static_cast<int>(a.to_bytes()[3])
            % static_cast<int>(a.to_bytes()[2])
            % static_cast<int>(a.to_bytes()[1])
            % static_cast<int>(a.to_bytes()[0])
            % d
               );
}
示例#2
0
CIPv4Address::CIPv4Address(boost::asio::ip::address_v4 v4addr, unsigned short port)
{
	m_sockaddr_in.sin_family = AF_INET;
	m_sockaddr_in.sin_port = htons (port);
	memcpy(&m_sockaddr_in.sin_addr.s_addr, &v4addr.to_bytes()[0], sizeof(m_sockaddr_in.sin_addr.s_addr));
}
示例#3
0
//	////////////////////////////////////////////////////////////////////////////
HostEntry HostAddressToEntry(const boost::asio::ip::address_v4 &host_address)
{

	return(HostAddressToEntry(host_address.to_bytes().data(),
		sizeof(boost::asio::ip::address_v4::bytes_type), AF_INET));
}