Boost C++ Libraries

...one 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.
PrevUpHomeNext

Daytime.5 - A synchronous UDP daytime server

This tutorial program shows how to use asio to implement a server application with UDP.

Create an ip::udp::socket object to receive requests on UDP port 13.

Wait for a client to initiate contact with us. The remote_endpoint object will be populated by ip::udp::socket::receive_from().

Determine what we are going to send back to the client.

Send the response to the remote_endpoint.

Finally, handle any exceptions.

See the full source listing

Return to the tutorial index

Previous: Daytime.4 - A synchronous UDP daytime client

Next: Daytime.6 - An asynchronous UDP daytime server


PrevUpHomeNext