实例介绍
UNIX Network Programming, Volume 1(3rd) 英文无水印pdf 第3版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Addison-Wesley Professional Computing Series Brian W. Kernighan and Craig Partridge, Consulting Editors Matthew H. Austern, Generic Programming and the STL: Using and Extending the C++ Standard Template Library David R. Butenhof, Programming with PosIX threads Brent Callaghan, Nfs lllustrated Tom Cargill, C++ Programming Style William R Cheswick /Steven M. Bellovin/Aviel D. Rubin, Firewalls and Internet Security, Second Edition: Repellin the wily hacker David A Curry, UINIX System Security: A Guide for Users and System Administrators Stephen C Dewhurst, C++ Gotchas: Avoiding Common Problems in Coding and Design Erich Gamma/Richard Helm/Ralph Johnson/John Vlissides, Design Patterns: Elements of reusable Object- Oriented Software Erich Gamma/Richard Helm/Ralph Johnson/John Vlissides, Design Patterns CD: Elements of Reusable Object- Oriented Software Peter Haggar, Practical Java Programming Language Guide David r. Hanson, C Interfaces and Implementations: Techniques for Creating Reusable software Mark Harrison/Michael McLennan, Effective TclTk Programming: Writing Better Programs with Tcl and Tk Michi Henning /Steve Vinoski, Advanced CORBA Programming with C++ Brian W. Kernighan/Rob Pike, The Practice of Programming S Keshav, An Engineering Approach to Computer Networking: ATM Networks, the Internet, and the Telephone Network John Lakos, Large-Scale C++ Software design Scott Meyers, Efective C++ CD: 85 Specific Ways to Improve Your Programs and Designs Scott Meyers, Effective C++, Second Edition: 50 Specific Ways to Improve Your Programs and Designs Scott Meyers, More Effective C++: 35 New Ways to Improve Your Programs and Designs Scott Meyers, Effective STL. 50 Specific Ways to Improve Your LIse of the Standard Template library Robert B. Murray, C++ Strategies and Tactics DavidR. Musser/Gillmer J. Derge/Atul Saini, STL Tutorial and Reference Guide, Second edition C++ Programming with the standard Template library John K. Ousterhout, Tcl and the Tk Toolkit Craig Partridge, Gigabit Networking Radia perlman, Interconnections, Second Edition: Bridges, Routers, Switches, and Internetworking protocols Stephen A Rago, UNIX. System V Network programming Curt Schimmel, UNIX Systems for Modern Architectures: Symmetric Multiprocessing and Caching for Kernel Programmers W. Richard Stevens/Bill Fenner/Andrew M. Rudoff, UNIX Network Programming Volume 1, Third Edition: The Sockets networking api W. Richard Stevens, Advanced Programming in the UNIX Environment W. Richard Stevens, TCP/P Illustrated, volume 1: The Protocols W. Richard Stevens Tcp/P Illustrated Volume 3: Tcp for Transactions Http Nntp and the Unix Domain protocols W. Richard Stevens/Gary R. Wright, TCP/IP Illustrated Volumes 1-3 Boxed Set John viega/Gary McGraw, Building Secure Software: How to Avoid Security Problems the right Way Gary R. Wright/W. Richard Stevens, TCP/LP Illustrated, Volume 2: The Implementation Ruixi Yuan/W. Timothy Strayer, Virtual Private Networks: Technologies and Solutions Visitwww.awprofessional.com/series/professionalcomputingformoreinformationaboutthesetitles UNIX Network Programming The Sockets Networking APl Volume1· Third edition W. Richard stevens Bill Fenner Andrew M. rudoff 升 Addison-Wesley Boston· San francisco· New York· Toronto· Montreal London· Munich· Paris· Madrid Capetown· Sydney· Tokyo· Singapore· Mexico city Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison Wesley was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals expressed or implied warranty of any kind and assume no responsibility for errors or o The authors and publisher have taken care in the preparation of this book, but make n omissions. No liability is assumed for incidental or consequential damages in connectior with or arising out of the use of the information or programs contained herein The publisher offers discounts on this book when ordered in quantity for bulk purchases and special sales. For more information please contact: U.S. Corporate and government sales (800)382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International sales (317)581-3793 international@pearsontechgroup.com VisitAddison-wesleyontheWeb:www.awprofessional.com Library of Congress Cataloging-in-Publication data A CIP catalog record for this book can be obtained from the Library of Congress Copyright o 2004 by Pearson Education, Inc All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any mcans, clectronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. Published simultaneously in Canada For information on obtaining permission for use of material from this work, please submit a written request to: Education ir Rights and Contracts Department 75 Arlington Street, Suite 300 Boston. ma o2ll6 Fax:(617)848-7047 ISBN:0-13-141155-1 Text printed on recycled paper irst printing To Rich A loha nui loa Contents Foreword XVII Preface XIX Part 1. Introduction and TCP/P Chapter 1 Introduction Introduction 2 A Simple Daytime Client 6 3 Protocol Independence 4 Error Handling: Wrapper Functions 11 1.5 A Simple Daytime Server 13 1.6 Roadmap to Client/Server EXamples in the Text 16 OSI Mode 18 1.8 BSD Networking History 20 9 est networks and hosts 22 .10 Unix Standard 25 64-Bit Architectures 28 1.12 Summary 29 Chapter 2. The Transport Layer: TCP, UDP, and SCTP 2.1 Introduction 31 2.2 The Big Picture 32 2.3 User Datagram Protocol(UDP) 34 VI viii UNIX Network Programming Contents 2.4 Transmission Control Protocol(TCP) 35 2.5 Stream Control Transmission Protocol (SCTP) 36 2.6 TCP Connection establishment and termination 37 2.7 TIME WAIT State 43 2.8 SCTP Association Establishment and termination 44 2.9 Port numbers 2.10 tcP Port numbers and concurrent sery 52 2.11 Buffer Sizes and Limitations 55 2.12 Standard Internet services 6 2.13 Protocol Usage by Common Internet Applications 62 2.14 Summary 3 Part 2. Elementary Sockets 65 Chapter 3. Sockets Introduction 67 3.1 Introduction 67 3.2 Socket Address Structures 67 3.3 Value-Result Arguments 74 3.4 Byte Ordering Functions 77 3.5 Byte Manipulation Functions 80 3.6 inet aton, inet addr and inet ntoa functions 82 3.7 inet ton and inet ntop Functions 83 38 sock ntop and Related Functions 86 3.9 read, writen, and readline functions 88 3.10 Summary 92 Chapter 4. Elementary TCP Sockets 4.1 Introduction 95 4.2 socket function 95 4.3 connect function 99 4.4 bind function 4.5 isten function 104 4.6 accept Function 109 4.7 fork and exec functions 4.8 Concurrent Servers 114 4.9 close function 117 4. 10 getsockname and getpeername Functions 117 4.11 Summary 120 Chapter 5. TCP Client/server Example 121 Introduction 121 52 TCP Echo Server main Function 122 5.3 TCP Echo Server: str echo function 123 TCP Echo Client: main Function 24 55 TCP Echo Client: str cli Function 125 5.6 Normal Startup 126 5.7 Normal termination 128 UNIX Network Programming Contents 58 POSIX Signal Handling 129 59 Handling SIGCHLD Signals 132 5.10 wait and waitpid Functions 135 5.11 Connection abort before accept Returns 139 5.12 Termination of server Process 141 5.13 SIGPIPE Signal 142 5. 14 Crashing of Server Host 144 5. 15 Crashing and Rebooting of Server Host 144 5.16 Shutdown of server Host 145 5.17 Summary of TCP Example 146 5.18 Data format 147 5.19 Summary 151 Chapter 6. W0 Multiplexing: The select and poll Functions 6.1 Introduction 153 6.2 lO Models 154 6.3 select Function 160 6.4 str cli Function(Revisited) 167 6.5 Batch Input and Buffering 169 6.6 shutdown function 172 7 str cli Function(Revisited Again 173 6.8 TCP Echo Server(Revisited) 175 6.9 select Function 181 6. 10 poll Function 182 6.11 TCP Echo Server(Revisited Again 185 6. 12 Summary 188 Chapter 7. Socket Options 191 7.1 Introduction 191 getsockopt and setsockopt Functions 192 7. 3 Checking if an Option Is Supported and obtaining the Default 194 7.4 Socket States 198 7.5 Generic Socket Options 198 7.6 IPv4 Socket Options 214 7.7 ICMPv6 Socket Option 216 7.8 IPv6 Socket Options 216 7.9 TCP Socket Options 219 7.10 SCTP Socket Options 222 7.11 Ecnt] Function 233 7.12 Summary 236 Chapter 8 Elementary UDP Sockets 239 8.1 Introduction 239 82 recvfrom and sendto functions 240 8.3 UDP Echo Server: main Function 241 8.4 UDP Echo Server: dg echo Function 242 8.5 UDP Echo Client: main function 244 8.6 UDP Echo Client: dg cli Function 245 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论