O'Reilly logo

Boost.Asio C++ Network Programming by John Torjo

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

Chapter 3. Echo Server/Clients

In this chapter, we'll implement a small client/server application, which is probably the easiest client/server application you will ever write. This is the Echo application, a server that echoes back anything a client writes, and then closes the client's connection. The server can handle any number of clients. As each client connects, it sends a message. The server receives the full message and sends it back. After that, it closes the connection.

Therefore, each Echo client connects to the server, sends a message, and reads what the server replies, making sure it's the same message it sent and finishes talking to the server.

We will implement first a synchronous application, and then an asynchronous application, so ...

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