| Home | Libraries | People | FAQ | More

### generic::datagram_protocol

Encapsulates the flags needed for a generic datagram-oriented socket.

    class datagram_protocol

##### Types

Name | Description
--- | ---
endpoint | The type of an endpoint.
socket | The generic socket type.

##### Member Functions

Name | Description
--- | ---
datagram_protocol | Construct a protocol object for a specific address family and protocol. Construct a generic protocol object from a specific protocol.
family | Obtain an identifier for the protocol family.
protocol | Obtain an identifier for the protocol.
type | Obtain an identifier for the type of the protocol.

##### Friends

Name | Description
--- | ---
operator!= | Compare two protocols for inequality.
operator== | Compare two protocols for equality.

The `generic::datagram_protocol` class contains flags necessary for datagram-oriented sockets of any address family and protocol.

##### Examples

Constructing using a native address family and socket protocol:

    datagram_protocol p(AF_INET, IPPROTO_UDP);

Constructing from a specific protocol type:

    datagram_protocol p(boost::asio::ip::udp::v4());

##### Thread Safety

Distinct objects: Safe.

Shared objects: Safe.

##### Requirements

Header: `boost/asio/generic/datagram_protocol.hpp`

Convenience header: `boost/asio.hpp`