Finally we convert listenfd to a listening descriptor

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: first develop an understanding of Unix file I/O, which is the topic of the next section. 12.4 Unix file I/O A Unix file is a sequence of Ò bytes ¼ ½ Ò ½ All I/O devices, such as networks, disks, and terminals, are modeled as files, and all input and output is performed by reading and writing the appropriate files. This elegant mapping of devices to files allows Unix to export a simple, low-level application interface, known as Unix I/O, that enables all input and output to be performed in a uniform and consistent way. Aside: Standard I/O and Unix I/O. The familiar, higher-level I/O routines in the C standard library, such as printf and scanf, are all implemented using the lower-level Unix I/O functions. End Aside. An application announces its intention to access an I/O device by asking the kernel to open the corresponding file. The kernel returns a small non-negative integer, called a descriptor, that identifies the file in all subsequent operations on the file. The kerne...
View Full Document

Ask a homework question - tutors are online