128x Filetype PDF File size 0.11 MB Source: www.gbv.de
Boost.Asio C++ Network Programming Enhance your skills with practical examples for C++ network programming John Torjo [ open source ] community experience distilled publishing"1 BIRMINGHAM MUMBAI - Table of Contents Preface 1 Chapter 1: Getting Started with Boost.Asio 5 What is Boost.Asio? 5 History 6 Dependencies 7 Building Boost.Asio 7 Important macros 8 Synchronousversus asynchronous 8 Exceptions versus error codes 11 Threading in Boost.Asio 12 Notjust networking 13 Timers 14 The io_service class 15 Summary 19 Chapter 2: Boost.Asio Fundamentals 21 The NetworkAPI 21 Boost.Asio namespaces 21 IP addresses 22 Endpoints 22 Sockets 23 Synchronous error codes 24 Socket member functions 24 Otherconsiderations 31 The read/write/connect free functions 35 The connect functions 35 The read/write functions 36 Table ofContents Asynchronous programming 40 The need for going asynchronous 40 Asynchronous run(), run_one(), poll(), poll_one() 44 Runningforever 44 The run_one(), poll(), poll_one() functions 45 Asynchronous work 47 Asynchronous post() versus dispatch() versus wrap() 50 Staying alive 52 Summary 55 Chapter 3: Echo Server/Clients 57 TCP Echoserver/clients 58 TCP synchronous client 59 TCP synchronous server 60 TCP asynchronous client 61 TCP asynchronous server 64 The code 66 UDP Echoserver/clients 66 UDP synchronous Echo client 67 UDP synchronous Echo server 68 Summary 68 Chapter4: Client and Server 69 The synchronous client/server 70 Synchronous client 70 Synchronous server 73 The asynchronous client/server 77 Asynchronous client 78 Asynchronous server 82 Summary 86 Chapter 5: Synchronous Versus Asynchronous 87 Mixing synchronous and asynchronous programming 87 Passing client to server messages and vice versa 88 Synchronous I/O in client applications 89 Synchronous I/O in server applications 92 Threading in a synchronous server 94 Asynchronous I/O in client applications 96 Asynchronous I/O in server applications 98 Threading in an asynchronous server 101 Asynchronous operations 104 implementing proxies 108 Summary 111 Table ofContents Chapter 6: Boost.Asio - Other Features 113 std streams and std buffer I/O 113 Boost.Asio and the STL streams 114 The streambufclass 116 Thefree functions that deal with streambuf objects 118 Co-routines 120 Summary 125 Chapter 7: Boost.Asio -Advanced Topics 127 Asioversus Boost.Asio 127 Debugging 128 Handlertracking information 128 An example 129 Handler tracking to file 131 SSL 132 Boost.Asio Windows features 133 Stream Handles 134 Random access Handles 134 Object Handles 135 Boost.Asio POSIX features 135 Local sockets 135 Connecting local sockets 136 POSIX file descriptors 136 Fork 137 Summary 138 Index 139
no reviews yet
Please Login to review.