boost::corosio::endpoint
An IP endpoint (address + port) supporting both IPv4 and IPv6.
Synopsis
Declared in <boost/corosio/endpoint.hpp>
class endpoint;
Description
This class represents an endpoint for IP communication, consisting of either an IPv4 or IPv6 address and a port number. Endpoints are used to specify connection targets and bind addresses.
The endpoint holds both address types as separate members (not a union), with a discriminator to track which address type is active.
Example
// IPv4 endpoint
endpoint ep4(ipv4_address::loopback(), 8080);
// IPv6 endpoint
endpoint ep6(ipv6_address::loopback(), 8080);
// Port only (defaults to IPv4 any address)
endpoint bind_addr(8080);
// Parse from string
endpoint ep;
if (auto ec = parse_endpoint("192.168.1.1:8080", ep); !ec) {
// use ep
}
Member Functions
Name |
Description |
|
Constructors |
Check if this endpoint uses an IPv4 address. |
|
Check if this endpoint uses an IPv6 address. |
|
Get the port number. |
|
Get the IPv4 address. |
|
Get the IPv6 address. |
Friends
| Name | Description |
|---|---|
Compare endpoints for inequality. |
|
Compare endpoints for equality. |
Created with MrDocs