Bsd Sockets Programming from a Multi-Language Perspective (Programming Series) (PAP/CDR)

  • ポイントキャンペーン

Bsd Sockets Programming from a Multi-Language Perspective (Programming Series) (PAP/CDR)

  • ただいまウェブストアではご注文を受け付けておりません。 ⇒古書を探す
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 350 p.
  • 言語 ENG
  • 商品コード 9781584502685
  • DDC分類 005.276

Full Description


BSD Sockets Programming from a Multi-Language Perspective is written for software developers who need to create a variety of network applications. It begins by detailing the efficient and effective uses of the BSD Sockets API for networked application development in multiple languages. From there the BSD API is covered in detail and the purpose of each function and socket option is identified, including the advanced behavioral side-effects of each. Having a thorough understanding of these issues and techniques is often the difference between being a novice and professional network application developer. Optimizing networked applications and avoiding common pitfalls are also addressed.After the solid foundational coverage of the Sockets API in Part I, Part II investigates it from a variety of language perspectives. Using six different languages in all, including imperative languages (C), object-oriented languages (Java), and scripting languages (Perl), you learn the advantages and disadvantages of each language as they relate to the development of networked applications and the Sockets API.Finally, in Part III, a set of software patterns is discussed for each language. Patterns include a simple HTTP server and SMTP client, and various Sockets communication styles (stream, datagram, multicast, and broadcast). These patterns can be used as the basis for more complex applications or to give you a quick-start when building networked applications. The patterns also illuminate the differences between the network APIs for each language and identify how certain languages make patterns simple and others make them complex. The accompanying CD-ROM includes all of the source code from the book, including the patterns detailed in Part III, as well as open source interpreters and other tools.

Table of Contents

Acknowledgments                                    xix
Part I Introduction to Sockets Programming 1 (156)
Networking Overview 3 (22)
What Is the Internet? 4 (1)
Internet Model of Communication 5 (1)
The IP Protocol Suite 6 (6)
Network Layer 6 (3)
Transport Layer 9 (3)
Application Layer 12 (1)
Types of Communication 12 (1)
Stream 13 (1)
Datagram 13 (1)
Broadcast 13 (1)
Multicast 13 (1)
Packet Processing in a Network Stack 13 (3)
Addressing 16 (1)
IP Addresses 16 (1)
Subnetting 17 (1)
Introduction to IP Routing 17 (4)
Simple Routing Example 18 (2)
Local (Interior) Ethernet Routing 20 (1)
Exterior Routing 20 (1)
Network Entities 21 (1)
Hosts 21 (1)
Bridges 22 (1)
Routers 22 (1)
Gateways 22 (1)
Summary 22 (1)
References 23 (1)
Resources 23 (2)
Introduction to Sockets Programming 25 (12)
The Sockets Programming Paradigm 26 (1)
Ports 26 (1)
Sockets 26 (1)
Addressing 27 (1)
Sample Server 27 (3)
Source Discussion 28 (2)
Sample Client 30 (2)
Source Discussion 31 (1)
Client/Server Symmetry 32 (1)
Network Byte Order 33 (1)
Swapping Byte Order 34 (1)
Summary 34 (1)
Resources 35 (2)
Standard BSD API Functions 37 (22)
socket Function 39 (1)
bind Function 40 (4)
listen Function 44 (1)
accept Function 45 (2)
connect Function 47 (3)
recv/recvfrom Function 50 (2)
send/sendto Function 52 (3)
close Function 55 (1)
htons/ntohs/htonl/ntohl Functions 55 (1)
inet_addr/inet_aton/inet_ntoa Functions 56 (1)
Summary 57 (1)
References 57 (2)
Advanced Sockets Functions 59 (20)
select Function 60 (5)
getsockname Function 65 (1)
getpeername Function 66 (1)
getsockopt/setsockopt Functions 67 (1)
shutdown Function 68 (1)
gethostname/sethostname Functions 69 (1)
gethostbyaddr Function 70 (2)
gethostbyname Function 72 (3)
getservbyname Function 75 (2)
getservbyport Function 77 (1)
Summary 78 (1)
References 78 (1)
Socket Options 79 (24)
Socket Options API 80 (21)
Sockets Layer Options 81 (9)
TCP Layer Options 90 (3)
IP Layer Options 93 (8)
Summary 101(1)
Resources 101(2)
Advanced Sockets Programming Topics 103(26)
Introduction 104(1)
Out-of-Band (OOB) Data 104(2)
Nonblocking Sockets 106(1)
Determining Peer Socket Closure 106(2)
Resolving a Domain Name to an IP Address 108(1)
Writing Servers for Multi-homed Nodes 109(4)
Timing Out a Socket Connect 113(3)
Data Framing (TCP vs. UDP) 116(4)
Connectionless and Connected Datagram 120(1)
Sockets
Timing Out a Read or Write Operation 121(2)
Determining Peer Information 123(1)
Determining the Protocol Argument for 123(2)
Socket
Identifying Service Ports and Protocols 125(2)
Summary 127(1)
References 127(2)
Optimizing Sockets Applications 129(14)
Introduction 130(1)
Ensuring Full-Sized Segments 130(1)
Optimizing the Send and Receive Buffer 131(2)
Sizes
Socket Buffer Sizes and TCP 131(1)
Socket Buffers and Performance 132(1)
Configuring the Socket Buffer Sizes 132(1)
Other Options 133(1)
Minimizing Latency with TCP_NODELAY 133(2)
Reading/Writing All Available Data 135(1)
Advantages and Disadvantages to Select 136(1)
Using Multiple Sockets 137(1)
Separating Control and Data Connections 138(1)
Using Stack Callbacks 138(1)
Using Zero-Copy Buffer Functions 139(1)
Using UDP instead of TCP 140(1)
Stack Selection 140(1)
Stack Configuration 141(1)
Summary 141(1)
References 141(2)
Sockets Programming Pitfalls 143(14)
Introduction 144(1)
Failing to use Function Return values 144(2)
Ignoring Peer Socket Closure 146(1)
Ignoring Endianness of Parameters in API 146(1)
Functions
Making Protocol Framing Assumptions 147(2)
Causing ``Address in Use'' Error for Bind 149(1)
Listening on Multiple Interfaces 149(1)
Initial UDP Datagrams Disappearing 150(1)
Defensive Programming 151(4)
Using Safe Functions to Avoid Buffer 151(1)
Overflow
Rigorously Checking Error Returns 152(1)
Rigorously Checking Input and Output 152(1)
Parameters
Declaring String Arrays 153(1)
Minimizing Protocol Feedback 153(1)
Initializing All Variables 154(1)
Enabling All Compiler Warnings 155(1)
Summary 155(1)
Resources 155(2)
Part II Sockets Programming from a 157(118)
Multi-Language Perspective
Network Programming in the C Language 159(14)
C Language Overview 160(1)
Origin of the C Language 160(1)
C Language Heritage 160(1)
Tools 160(1)
Compiler/Tools Used 160(1)
Networking API Used 160(1)
Where to Download 160(1)
Networking API for C 161(11)
Sockets API Summary 161(1)
Sockets API Discussion 162(10)
Summary 172(1)
Resources 172(1)
Network Programming in Java 173(22)
Java Language Overview 174(1)
Origin of the Java Language 174(1)
Java Language Heritage 174(1)
Tools 174(1)
Interpreter/Tools Used 174(1)
Networking API Used 175(1)
Where to Download 175(1)
Networking API for Java 175(17)
Sockets API Summary 175(5)
Sockets API Discussion 180(12)
Specialized Networking APIs for Java 192(2)
Java URL Class for HTTP 193(1)
Summary 194(1)
References 194(1)
Resources 194(1)
Network Programming in Python 195(20)
Python Language Overview 196(1)
Origin of the Python Language 196(1)
Python Language Heritage 196(1)
Tools 196(1)
Interpreter/Tools Used 197(1)
Networking API Used 197(1)
Where to Download 197(1)
Networking API for Python 197(13)
Sockets API Discussion 197(13)
Specialized Networking APIs for Python 210(3)
Python smtplib Module 211(1)
Python httplib Module 211(1)
Python SocketServer Module 212(1)
Summary 213(1)
References 213(1)
Resources 213(2)
Network Programming in Perl 215(22)
Perl Language Overview 216(1)
Origin of the Perl Language 216(1)
Perl Language Heritage 216(1)
Tools 216(1)
Interpreter/Tools Used 216(1)
Networking API Used 217(1)
Where to Download 217(1)
Networking API for Perl 217(17)
Sockets API Discussion 218(16)
Specialized Networking APIs for Perl 234(1)
Perl Net::SMTP Module 234(1)
Perl LWP::Simple Module 235(1)
Summary 235(1)
References 236(1)
Resources 236(1)
Network Programming in Ruby 237(22)
Ruby Language Overview 238(1)
Origin of the Ruby Language 238(1)
Ruby Language Heritage 238(1)
Tools 238(1)
Interpreter/Tools Used 238(1)
Networking API Used 238(1)
Where to Download 239(1)
Networking API for Ruby 239(17)
Class vs. Instance Methods 240(1)
Sockets API Summary 240(3)
Sockets API Discussion 243(13)
Specialized Networking APIs for Ruby 256(1)
Ruby Net::SMTP Class 256(1)
Ruby Net::HTTP Class 257(1)
Summary 257(1)
References 257(1)
Resources 258(1)
Network Programming in Tcl 259(16)
Tcl Language Overview 260(1)
Origin of the Tcl Language 260(1)
Tcl Language Heritage 260(1)
Tools 260(1)
Interpreter/Tools Used 261(1)
Networking API Used 261(1)
Where to Download 261(1)
Networking API for Tcl 261(11)
Sockets API Discussion 262(10)
Summary 272(1)
References 273(1)
Resources 273(2)
Part III Software Patterns from a 275(154)
Multi-Language Perspective
Software Patterns Introduction 277(12)
Introduction 278(1)
Stream Server/Client Design 278(1)
Datagram Server/Client Design 279(1)
Broadcast Datagram Server/Client Design 280(1)
Multicast Datagram Server/Client Design 281(1)
Simple HTTP Server Design 282(3)
Simple SMTP Client Design 285(3)
Summary 288(1)
Resources 288(1)
Network Code Patterns in C 289(26)
Introduction 290(1)
Stream (TCP) Server/Client 290(4)
Stream Server 290(3)
Stream Client 293(1)
Datagram (UDP) Server/Client 294(4)
Datagram Server 294(3)
Datagram Client 297(1)
Multicast Server/Client 298(4)
Multicast Server 298(2)
Multicast Client 300(2)
Broadcast Server/Client 302(3)
Broadcast Server 302(2)
Broadcast Client 304(1)
Simple HTTP Server 305(5)
Simple SMTP Client 310(5)
Network Code Patterns in Java 315(28)
Introduction 316(1)
Stream (TCP) Server/Client 316(4)
Stream Server 316(2)
Stream Client 318(2)
Datagram (UDP) Server/Client 320(5)
Datagram Server 320(3)
Datagram Client 323(2)
Multicast Server/Client 325(4)
Multicast Server 325(2)
Multicast Client 327(2)
Simple HTTP Server 329(7)
Simple SMTP Client 336(7)
Network Code Patterns in Python 343(22)
Introduction 344(1)
Stream (TCP) Server/Client 344(3)
Stream Server 344(2)
Stream Client 346(1)
Datagram (UDP) Server/Client 347(2)
Datagram Server 347(1)
Datagram Client 348(1)
Multicast Server/Client 349(3)
Multicast Server 349(1)
Multicast Client 350(2)
Broadcast Server/Client 352(2)
Broadcast Server 352(1)
Broadcast Client 353(1)
Simple HTTP Server 354(6)
Simple SMTP Client 360(5)
Network Code Patterns in Perl 365(22)
Introduction 366(1)
Stream (TCP) Server/Client 366(3)
Stream Server 366(2)
Stream Client 368(1)
Datagram (UDP) Server/Client 369(2)
Datagram Server 369(1)
Datagram Client 370(1)
Multicast Server/Client 371(3)
Multicast Server 372(1)
Multicast Client 373(1)
Broadcast Server/Client 374(3)
Broadcast Server 374(1)
Broadcast Client 375(2)
Simple HTTP Server 377(5)
Simple SMTP Client 382(5)
Network Code Patterns in Ruby 387(22)
Introduction 388(1)
Stream (TCP) Server/Client 388(3)
Stream Server 388(2)
Stream Client 390(1)
Datagram (UDP) Server/Client 391(2)
Datagram Server 391(1)
Datagram Client 392(1)
Multicast Server/Client 393(3)
Multicast Server 393(1)
Multicast Client 394(2)
Broadcast Server/Client 396(2)
Broadcast Server 396(1)
Broadcast Client 397(1)
Simple HTTP Server 398(5)
Simple SMTP Client 403(6)
Network Code Patterns in Tcl 409(20)
Introduction 410(1)
Stream (TCP) Server/Client 410(3)
Stream Server 410(2)
Stream Client 412(1)
Datagram (UDP) Client 413(2)
Datagram Client 413(2)
Multicast Server/Client 415(3)
Multicast Server 415(2)
Multicast Client 417(1)
Broadcast (UDP) Client 418(1)
Simple HTTP Server 419(5)
Simple SMTP Client 424(5)
Appendix A About the CD-ROM 429(4)
System Requirements 429(1)
Operating System Requirements 429(1)
On the CD-ROM 429(1)
Software Patterns 430(1)
Software Tools 430(1)
Software License 430(3)
Appendix B Acronyms 433(4)
Index 437