Book Image

Boost.Asio C++ Network Programming

By : Wisnu Anggoro
Book Image

Boost.Asio C++ Network Programming

By: Wisnu Anggoro

Overview of this book

Table of Contents (15 chapters)
Boost.Asio C++ Network Programming Second Edition
About the Authors
About the Reviewers


There are three basic steps when it comes to developing a network application. The first step includes establishing a connection between the source and target, which means the client and server. We can configure the socket object along with the acceptor object to establish the connection.

Secondly, we exchange data by reading and writing to the socket. For this purpose, we can use the basic_stream_socket functions collection. In our previous example, we used the boost::asio::async_write() method to send the data and the boost::asio::async_read() method to receive the data. Finally, the last step is releasing the connection. By using the shutdown() method in the ip::tcp::socket object, we can disable the sending and receiving of data on the socket. Then, invoking the close() method after the shutdown() function will close the socket and free up the handler. We also have already created a wrapper for all functions, which is most frequently used in network application programming by...