Preface (CSDN also has Markdown, haokensen), csdnmarkdown

Source: Internet
Author: User
Tags packt

Preface (CSDN also has Markdown, haokensen), csdnmarkdown
Excellent practice

Improve your strength in specific C ++ Network Programming

John Torjo

Boost. Asio C ++ Network Programming

Copyright 2013 Packt Publishing

About the author

As an authoritative C ++ expert, besides occasionally using C # and Java to write programs,John TorjoHe contributed most of his programming career over 15 years to C ++.

He also enjoys writing programming-related articles in C ++ Users Journal and other magazines.

In his spare time, he enjoys playing poker and driving fast trains. He has many freelancers, one of which combines his two hobbies, one playing poker and the other programming. If you want to contact him, you can send an email to the john.code@torjo.com.

I would like to thank my friend Alexander Ru Chis, Aurelian Hale, Bela Tibor Bartha, Cristian Fatu, Horia Uifaleanu, niclae Ghimbovschi and Ovidiu Deac. I would like to thank them for their feedback and comments on this book. At the same time, I would like to thank all of you at Packt for your inclusiveness in my frequent missed deadline. Then, I would like to thank Chris Kohlhoff, the author of Boost. Asio, who wrote such a great library.

I will dedicate this book to my best friend Darius.

About reviewers

Béla Tibor Bartha

A professional software engineer who has used multiple technologies and languages for development. Even though he has been developing iOS and OSX applications for the past four years, C ++ has spent some time with him in the development of personal game projects.

I want to thank John because he can review this book.

Niclae Ghimbovschi

An individual developer who has participated in various C ++ projects for more than five years. He is mainly involved in enterprise communication projects. As an avid Linux enthusiast, he prefers to use different operating systems, script tools, and programming languages for testing and experimentation. In addition to programming, he also enjoys cycling, yoga, and meditation.

I want to thank John for letting me review this book.

About translators

Non-mainstream program ape mmoaay, the technology is very bad, like graphic design, mouse painting, dating, sports and translation, but indeed as a program ape mixed in the IT industry. If you love open source, you have to do the design and translation work when the technology is poor.

Weibo: http://weibo.com/smmoaay

About avplayer

Http://avplayer.org China's first technology community.

Directory

Preface

Chapter 1: Boost. Asio

What is Boost. Asio? History dependencies Boost. Asio important macro synchronization VS asynchronous exceptions VS error code multi-threading in Boost. Asio is not just a summary of network timer io_service classes

Chapter 2: Basic Principles of Boost. Asio

Network APIBoost. Asio namespace IP address endpoint Sockets synchronization error code Socket member function other considerations read/write/connect free function connect function read/write function asynchronous programming why asynchronous? Asynchronous run (), run_one (), poll (), poll_one () continuous run run_one (), poll (), poll_one () functions asynchronously work asynchronous post () VS dispatch () VS wrap () Keep running Summary

Chapter 3: echo server/client

TCP echo server/client TCP synchronization server TCP asynchronous client TCP synchronization server code UDP echo server/client UDP synchronous echo server Summary

Chapter 4: client and server

Synchronous Client/Server synchronous client synchronous server asynchronous client/server asynchronous client Asynchronous Server Summary

Chapter 5: Synchronous VS asynchronous

Synchronous asynchronous hybrid programming the communication of messages between the client and the server. synchronous I/O in the synchronous I/O Server Software of the client, synchronous I/O synchronization in the thread client software of the server summary of asynchronous I/O Asynchronous Server thread asynchronous operation proxy implementation

Chapter 6: Boost. Asio-Other features

Std streams and std buffer I/OBoost. Asio and STL streambuf class are used to process the free function coroutine of streambuf objects.

Chapter 7: Boost. Asio-advanced

Asio VS Boost. example of Asio debug handler tracing information SSLBoost of the handler Tracing file. asio Windows features stream processing random storage processing object processing Boost. asio POSIX features local sockects connection local sockets POSIX file descriptor Fork Summary

Index

Preface

Network programming has been around for a long time and is a very challenging task. Boost. Asio provides an excellent abstraction for network programming to ensure that you can use a small amount of programming to create an elegant client/server software. In the process of creation, it can make you experience great fun. But more beneficial: Boost. asio includes some non-network features, using Boost. the code written by Asio is compact and easy to read. If you follow what I have mentioned in the book, your code will be impeccable.

What does this book cover?

Chapter 1: Boost. AsioWhat is Boost. Asio? How to compile it? Some examples are provided. You will find that Boost. Asio is not just a network library. At the same time, you will also be exposed to io_service, the core class in Boost. Asio.

Chapter 2: Basic Principles of Boost. AsioIncluding what you must know: when to use Boost. Asio? We will gain an in-depth understanding of asynchronous programming-a more skillful and fun programming method than synchronization. This chapter also serves as a reference for the development of your own network applications.

Chapter 3: echo server/clientIt will show you how to implement a small client/server application. Maybe this will be the simplest Client/Server application you have ever written. The echo application is a service that sends any message sent from the client back and closes the client connection. We will first implement a synchronous application and then implement an asynchronous application, so that you can easily see the differences between them.

Chapter 4: client and serverWe will discuss in depth how to use Boost. Asio to create a simple client/server application. We will discuss how to avoid defects such as memory leaks and deadlocks. All programs are simple frameworks that allow you to expand and meet your needs more conveniently.

Chapter 5: Synchronous VS asynchronousIt will show you the things you need to consider when you choose synchronous or asynchronous mode. First, avoid obfuscation. In this chapter, we will find how easy it is to implement, test, and debug each type of application.

Chapter 6: Other features of Boost. AsioIt will show you some unknown features of Boost. Asio. Although std streams and streambufs are a little difficult to use, they show their unique advantages. Finally, you will see the late Boost. Asio coroutine, which allows you to write asynchronous code in a more readable way. (Just as it is synchronized)

Chapter 7: Advanced Boost. AsioIt will handle some advanced problems of Boost. Asio. Although you do not need to study them in daily programming, it is helpful to know about them (Boost. Asio advanced debugging, SSL, Windows features, POSIX features, etc ).

What do you need to prepare for reading this book?

To compile Boost. Asio and run examples in this book, you need a modern compiler. For example, Visual Studio 2008 and later versions, or g ++ 4.4 and later versions

Who prepared this book?

This book is a good news for developers who require network programming but do not want to study complex original network APIs in depth. All you need is a simple abstraction provided by Boost. Asio. As part of the famous Boost C ++ library, you only need to add a few extra # include files to convert to Boost. Asio.

Before reading this book, you need to be familiar with the knowledge of Boost core libraries, such as Boost smart pointers and boost :: noncopyable, Boost Functors, Boost Bind, shared _ from_this/enabled_shared_from_this and Boost threads (threads and mutex ). You also need to know the Boost Date/Time. Readers also need to know the concept of blocking and the "non-blocking" operation.

Conventions

You will find that different types of information are distinguished using different styles of text in this book. Examples of these styles and their explanations are given here.

The code in the text is displayed as follows:Io_serviceThe example is enough ".

A piece of code looks like this:

read(stream, buffer [, extra options])async_read(stream, buffer [, extra options], handler)write(stream, buffer [, extra options])async_write(stream, buffer [, extra options], handler)

Professional words and important wordsDisplay in bold

[! Warning or important comments are in such a box.]

[? Tip in this box]

Reader feedback

We welcome feedback from readers. Tell us what you think of this book-what you like and what you don't like. Reader feedback is very important to us. It allows us to write the books that help readers the most.

You only need to send an email to the feedback@packtpub.com for general feedback, note that the title of the subject in the mail.

If you have a special topic and want to write a book or contribute to it. Please refer to our reference on www.packtpub.com/authors.

User Support

Now that you are the owner of Packt books, we will tell you some things to maximize the benefits of purchasing this book.

Download Sample Code

You can log on to your account in http://www.packtpub.com and download all the sample code for the books you purchased. At the same time, you can access http://www.packtpub.com/supportfor registration. Then, these sample code files will be directly sent to your mailbox.

Error Correction

Although we have done our best to ensure the accuracy of the content in the certificate, errors always exist. If you find errors in our books-maybe text or code-if you can report them to us, we would be very grateful. In this way, you can not only help other readers avoid some doubts, but also help us to improve the next version of this book. If you find any location to be corrected, visit http://www.packtpub.com/submit-errata. Select your domicile and clickErrata submission formLink, and enter detailed error correction information to report the error to us. Once confirmed, your submission will be passed to our website or added to the error correction list in the error correction information area of the book. For any error correction, visit http://www.packtpub.com/support.

Q &

If you have any questions about this book, you can contact us via questions@packtpub.com. We will do our best to answer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.