Implementing a synchronous UDP client

A synchronous UDP client is a part of a distributed application that complies with the following statements:

  • Acts as a client in the client-server communication model
  • Communicates with the server application using UDP protocol
  • Uses I/O and control operations (at least those I/O operations that are related to communication with the server) that block the thread of execution until the corresponding operation completes, or an error occurs

A typical synchronous UDP client works according to the following algorithm:

  1. Obtain an IP-address and a protocol port number of each server the client application is intended to communicate with.
  2. Allocate a UDP socket.
  3. Exchange messages with the servers.
  4. Deallocate the socket.

This recipe ...

Get Boost.Asio C++ Network Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.