Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
ip::basic_endpoint::basic_endpoint (2 of 5 overloads)

Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.

    const InternetProtocol & internet_protocol,
    port_type port_num);

To initialise an IPv4 TCP endpoint for port 1234, use:

boost::asio::ip::tcp::endpoint ep(boost::asio::ip::tcp::v4(), 1234);

To specify an IPv6 UDP endpoint for port 9876, use:

boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);