UNIX Network Programming, Volume 1 - W. Richard Stevens

UNIX Network Programming, Volume 1

Networking APIs - Sockets and XTI
Buch | Hardcover
1240 Seiten
1997 | 2nd edition
Prentice Hall (Verlag)
978-0-13-490012-4 (ISBN)
52,35 inkl. MwSt
zur Neuauflage
  • Titel erscheint in neuer Auflage
  • Artikel merken
Zu diesem Artikel existiert eine Nachauflage
Appropriate for introductory and advanced courses in UNIX Programming.

This first in a three-volume set is the most thorough and authoritative guide to UNIX networking APIs available.
49001-1 The only guide to UNIX network programming APIs you'll ever need! Whether you write Web servers, client/server applications, or any other network software, you need to understand networking APIS-especially sockets in greater detail than ever before. You need UNIX Network Programming, Volume 1, Second Edition. In this book, leading UNIX networking expert W. Richard Stevens offers unprecedented, start-to-finish guidance on making the most of sockets, the de facto standard for UNIX network programming-as well as extensive coverage of the X/Open Transport Interface (XTI). Stevens begins by introducing virtually every basic capability of TCP and UDP sockets, including socket functions and options, I/O multiplexing, and name and address conversions. He presents detailed coverage of the Posix.1g standard for sockets and the Posix threads. He also introduces advanced techniques for: *Establishing IPv4/IPv6 interoperability. *Implementing non-blocking I/O. *Routing sockets. *Broadcasting and multicasting. *IP options. *Multithreading. *Advanced name and address conversions. *UNIX domain protocols. *Raw sockets.Learn how to choose among today's leading client/server design approaches, including TCP iterative, concurrent, preforked and prethreaded servers.
Master the X/Open Transport Interface, including XTI TCP clients and servers, name and address functions, options, streams and additional functions. The Internet/intranet revolution has dramatically increased the demand for developers with a sophisticated understanding of network programming APIs, especially sockets. One book contains all you need to know: UNIX Network Programming, Volume 1, Second Edition.

I. INTRODUCTION AND TCP/IP.

1. Introduction.


Introduction. A Simple Daytime Client. Protocol Independence. Error Handling: Wrapper Functions. A Simple Daytime Server. Road Map to Client-Server Examples in the Text. OSI Model. BSD Networking History. Test Networks and Hosts. Unix Standards. 64-bit Architectures. Summary.

2. The Transport Layer: TCP and UDP.


Introduction. The Big Picture. UDP: User Datagram Protocol. TCP: Transmission Control Protocol. TCP Connection Establishment and Termination. TIME_WAIT State. Port Numbers. TCP Port Numbers and Concurrent Servers. Buffer Sizes and Limitations. Standard Internet Services. Protocol Usage by Common Internet Applications. Summary.

II. ELEMENTARY SOCKETS.

3. Sockets Introduction.


Introduction. Socket Address Structures. Value-Result Arguments. Byte Ordering Functions. Byte Manipulation Functions. inet_aton, inet_addr, and inet_ntoa Functions. inet_pton and inet_ntop Functions. sock_ntop and Related Functions. readn, writen, and readline Functions. isfdtype Funtion. Summary.

4.


Introduction. socket Function. connect Function. bind Function. listen Function. accept Function. fork and exec Functions. Concurrent Servers. close Function. getsockname and getpeername Functions. Summary.

5. TCP Client-Server Example.


Introduction. TCP Echo Server: main Function. TCP Echo Server: str_echo Function. TCP Echo Client: main Function. TCP Echo Client: str_cli Function. Normal Startup. Normal Termination. Posix Signal Handling. Handling SIGCHLD Signals. wait and waitpid Functions. Connection Abort Before accept Returns. Termination of Server Process. SIFPIPE Signal. Crashing of Server Host. Crashing and Rebooting of Server Host. Shutdown of Server Host. Summary of TCP Example. Data Format. Summary.

6. I/O Multiplexing: the select and poll Function.


Introduction. I/O Models. select Function. str_cli Function (Revisited). Batch Input. shutdown Function. str_cli Function (Revisited Again). TCP Echo Server (Revisited). pselect Function. poll Function. TCP Echo Server (Revisited Again). Summary.

7. Socket Options.


Introduction. getsockopt and setsockopt Functions. Checking if an Option is Supported and Obtaining the Default. Socket States. Ipv6 Socket Options. TCP Socket Options. fcntl Function. Summary.

8. Elementary UDP Sockets.


Introduction. recvfrom and sendto Function. UDP Echo Server: main Function. UDP Echo Server: dg_echo Function. UDP Echo Client: main Function. UDP Echo Client: dg_cli Function. Lost Datagrams. Verifying Received Response. Server Not Running. Summary of UDP example. connect Function With UDP. dg_cli Function (Revisited). Lack of Flow Control With UDP. Determining Outgoing Interface with UDP. TCP and UDP Echo Server Using select. Summary.

9. Elementary Name and Address Conversions.


Introduction. Domain Name System. gethostbyname Function. RES_USE_INET6 Resolver Option. gethosbyname2 Function and Ipv6 Support. gethosbyaddr Function. uname Function. gethostname Function. getservbyname and getservbyport Functions. Other Networking Information. Summary.

III. Advanced Sockets.

10. IPv4 and IPv6 Interoperability.


Introduction. Ipv4 Client, Ipv6 Server. Ipv6 Client, Ipv4 Server. Ipv6 Address Testing Macros. IPV6_ADDRFORM Socket Option. Source Code Portability. Summary.

11. Advanced Name and Address Conversions.


Introduction. getaddrinfo Function. gai_strerror Function. freeaddringo Function. getaddrinfo Function: Ipv6 and Unix Domain. getaddrinfo Function: Examples. host_serv Function. tcp_connect Function. tcp_listen Function. udp_client Function. udp_connect Function. udp_server Function. getnameinfo Function. Reentrant Functions. gethostbyname_r and gethostbyaddr_r Functions. Implementation of getaddrinfo and getnameinfo Functions. Summary.

12. Daemon Processes and inetd Superserver.


Introduction. syslogd Daemon. syslog Function. daemon_init Function. inetd Daemon. daemon_inetd Function. Summary.

13. Advanced I/O Functions.


Introduction. Socket Timeouts. recv and send Functions. readv and writev Functions. recvmsg and sendmsg Functions. Ancillary Data. How Much Data is Queued? Sockets and Standard I/O. IT/TCP: TCP for Transactions. Summary.

14. Unix Domain Protocols.


Introduction. Unix Domain Socket Address Structure. socketpair Function. Socket Functions. Unix Domain Stream Client-Server. Unix Domain Datagram Client-Server. Passing Descriptors. Receiving Sender Credentials. Summary.

15. Nonblocking I/O.


Introduction. Nonblocking Reads and Writes: str_cli Function (Revisited). Nonblocking connect. Nonblocking connect: Daytime Client. Nonblocking connect: Web Client. Nonblocking accept. Summary.

16. ioctl Operations.


Introduction. ioctl Function. Socket Operations. File Operations. Interface Configuration. get_ifi_info Function. Interface Operations. ARP Cache Operations. Routing Table Operations. Summary.

17. Routing Sockets.


Introduction. Datalink Sockect Address Structure. Reading and Writing. sysctl Operations. get_ifi_info Function. Interface Name and Index Functions. Summary.

18. Broadcasting.


Introduction. Broadcast Addresses. Unicast Versus Broadcast. dg_cli Function Using Broadcasting. Race Conditions. Summary.

19. Multicasting.


Introduction. Multicast Addresses. Multicasting Versus Broadcasting on A LAN. Multicasting on A WAN. Multicast Socket Options. mcast_join and Related Functions. dg_cli Function Using Multicasting. Receiving MBone Session Announcements. Sending and Receiving. SNTP: Simple Network Time Protocol. SNTP (Continued). Summary.

20. Advanced UDP Sockets.


Introduction. Receiving Flags, Destination IP Address, and Interface Index. Datagram Truncation. When to Use UDP Instead of TCP. Adding Reliability to a UDP Application. Binding Interface Addresses. Concurrent UDP Servers. IPv6 Packet Information. Summary.

21. Out-of-Band Data.


Introduction. TCP Out-of-Band Data. sockatmark Function. TCP Out-of_Band Data Summary. Client-Server Heartbeat Functions. Summary.

22. Signal-Driven I/O.


Introduction. Signal-Driven I/O for Sockets. UDP Echo Server Using SIGIO. Summary.

23. Threads.


Introduction. Basic Thread Functions: Creation and Termination. str_cli Function Using Threads. TCP Echo Server Using Threads. Thread-Specific Data. Web Client and Simultaneous Connections (Continued). Mutexes: Mutual Exclusion. Condition Variables. Web Client and Simultaneous Connections (Continued). Summary.

24. IP Options.


Introduction. IPv4 Options. IPv4 Source Route Options. IPv6 Extension Headers. IPv6 Hop-by-Hop Options and Destination Options. IPv6 Routing Header. IPv6 Sticky Options. Summary.

25. Raw Sockets.


Introduction. Raw Socket Creation. Raw Socket Output. Raw Socket Input. Ping Program. Traceroute Program. An ICMP Message Daemon. Summary.

26. Datalink Access.


Introduction. BPF: BSD Packet Filter. DLPI: Data Link Provider Interface. Linux: SOCK_PACKET. libcap: Packet Capture Library. Examining the UDP Checksum Field. Summary.

27. Client-Server Design Alternatives.


Introduction. TCP Client Alternatives. TCP Test Client. TCP Iterative Server. TCP Concurrent Server, One Child per Client. TCP Preforked Server, No Locking Around accept. TCP Preforked Server, File Locking Around accept. TCP Preforked Server, Thread Locking Around accept. TCP Preforked Server, Descriptor Passing. TCP Concurrent Server, One Thread per Client. TCP Prethreaded Server, Per-Thread accept. TCP Prethreaded Server, Main Thread accept. Summary.

IV. XTI: X/OPEN TRANSPORT INTERFACE.

28. XTI: TCP Clients.


Introduction. t_open Function. t_error and t_strerror Functions. netbuf Structures and XTI Structures. t_bind Function. t_connect Function. t_rcv and t_snd Functions. t_look Function. t_sndrel and t_rcvrel Functions. t_snddis and t_rcvdis Functions. XTI TCP Daytime Client. xti_rdwr Function. Summary.

29. XTI: Name and Address Functions.


Introduction. /etc/netconfig File and netconfig Functions. NETPATH Variable and netpath Functions. netdir Functions. t_alloc and t_free Functions. t_getprotaddr Functions. xti_ntop Function. tcp_connect Function. Summary.

30. XTI: TCP Servers.


Introduction. t_listen Function. tcp_listen Function. t_accept Function. xti_accept Function. Simple Daytime Server. Multiple Pending Connections. xti_accept Function (Revisited). Summary.

31. XTI: UDP Clients and Servers.


Introduction. t_rcvudata and t_sndudata Functions. udp_client Function. t_rcvuderr Function: Asynchronous Errors. udp_server Function. Reading a Datagram in Pieces. Summary.

32. XTI Options.


Introduction. t_opthdr Structure. XTI Options. t_optmgmt Function. Checking if an Option is Supported and Obtaining the Default. Getting and Setting XTI Options. Summary.

33. Streams.


Introduction. Overview. getmsg and putmsg Functions. getpmsg and putpmsg Functions. ioctl Function. TPI: Transport Provider Interface. Summary.

34. XTI: Additional Functions.


Introduction. Nonblocking I/O. t_rcvconnect Function. t_getinfo Function. t_getstate Function. t_sync Function. t_unbind Function. t_rcvv and t_rcvvudata Functions. t_sndv and t_sndvudata Functions. t_rcvreldata and t_sndreldata Functions. Signal-Driven I/O. Out-of-Band Data. Loopback Transport Providers. Summary.

Appendix A. IPv4, IPv6, ICMPv4, and ICMPv6.


Introduction. IPv4 Header. IPv6 Header. IPv4 Addresses. IPv6 Addresses. ICMPv4 and ICMPv6: Internet Control Message Protocol.

Appendix B. Virtual Networks.


Introduction. The Mbone. The 6bone.

Appendix C. Debugging Techniques.


System Call Tracing. Standard Internet Services. sock Program. Small Test Program. tcpdump Program. netstat Program. lsof Program.

Appendix D. Miscellaneous Source Code.


unp.h Header. config.h Header. unpxti.h Header. Standard Error Routines.

Appendix E. Solutions to Selected Exercises.
Bibliography.
Index.

Erscheint lt. Verlag 31.10.1997
Verlagsort Upper Saddle River
Sprache englisch
Maße 195 x 242 mm
Gewicht 1702 g
Themenwelt Informatik Betriebssysteme / Server Unix / Linux
Mathematik / Informatik Informatik Netzwerke
ISBN-10 0-13-490012-X / 013490012X
ISBN-13 978-0-13-490012-4 / 9780134900124
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Die wichtigen Befehle

von Daniel J. Barrett

Buch | Softcover (2024)
O'Reilly (Verlag)
16,90
das umfassende Handbuch

von Dirk Deimeke; Daniel van Soest; Stefan Kania

Buch | Hardcover (2023)
Rheinwerk (Verlag)
69,90
das umfassende Handbuch

von Michael Kofler

Buch | Hardcover (2023)
Rheinwerk (Verlag)
49,90