O'Reilly logo

Boost.Asio C++ Network Programming Cookbook by Dmytro Radchuk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing a synchronous iterative TCP server

A synchronous iterative TCP server is a part of a distributed application that satisfies the following criteria:

  • Acts as a server in the client-server communication model
  • Communicates with client applications over TCP protocol
  • Uses I/O and control operations that block the thread of execution until the corresponding operation completes, or an error occurs
  • Handles clients in a serial, one-by-one fashion

A typical synchronous iterative TCP server works according to the following algorithm:

  1. Allocate an acceptor socket and bind it to a particular TCP port.
  2. Run a loop until the server is stopped:
    1. Wait for the connection request from a client.
    2. Accept the client's connection request when one arrives.
    3. Wait for the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required