Unlike processes which share almost nothing threads

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rnet applications, the sin family member is AF INET, the sin port member is a 16-bit port number, and the sin addr member is a 32-bit IP address. The IP address and port number are always stored in network (big-endian) byte order. Aside: What does the in suffix mean? The in suffix is short for internet, not input. End Aside. Aside: Why do we need that sockaddr structure? The generic sockaddr structure in Figure 12.23 is an unfortunate historical artifact that confuses many programmers. The sockets interface was designed in the early 1980’s to work with any type of underlying network protocol, 630 CHAPTER 12. NETWORK PROGRAMMING Client socket Server socket bind open_clientfd listen connection request open_listenfd connect accept writen readline Await connection request from next client readline EOF writen close readline close Figure 12.22: Overview of the sockets interface. sockaddr: socketbits.h (included by socket.h). sockaddr in: netinit/in.h /* Generic socket address structure (for connect, bind, and accept) */ struct sockaddr { unsigned short sa_family; /* protocol family */ char sa_data[14]; /* addr...
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.

Ask a homework question - tutors are online