This preview shows page 1. Sign up to view the full content.
Unformatted text preview: d program is a recipe for disaster. Thus, we recommend avoiding the standard I/O functions for input and output on network sockets. Use the robust readn, writen, and readline functions instead. 12.5 The Sockets Interface
The sockets interface is a set of functions that are used in conjunction with the Unix ﬁle I/O functions to build network applications. It has been implemented on most modern systems, including Linux and the other Unix variants, Windows, and Macintosh systems. Figure 12.22 gives an overview of the sockets interface in the context of a typical client-server transaction. You should use this picture as road map when we discuss the individual functions. 12.5.1 Socket Address Structures
From the perspective of the Unix kernel, a socket is an endpoint for communication. From the perspective of a Unix program, a socket is an open ﬁle with a corresponding descriptor. Internet socket addresses are stored in 16-byte structures of the type sockaddr in shown in Figure 12.23. For Inte...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American