Implementing a synchronous TCP client

A synchronous TCP 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 a TCP protocol
  • Uses I/O and control operations (at least those I/O operations that are related to communication with a server) that block the thread of execution until the corresponding operation completes, or an error occurs

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

  1. Obtain the IP-address and the protocol port number of the server application.
  2. Allocate an active socket.
  3. Establish a connection with the server application.
  4. Exchange messages with the server.
  5. Shut down the connection. ...

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.