C figure 1225 open listenfd helper function that

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: l keeps track of all information about the open file; the application keeps keep track of only the descriptor. 620 CHAPTER 12. NETWORK PROGRAMMING The kernel maintains a file position , initially 0, for each open file. An application can set the current file position explicitly by performing a seek operation. A read operation copies Ñ ¼ bytes from the file to memory, starting at the current file position , and then incrementing by Ñ. A read operation with Ò triggers a condition known as end-of-file (EOF), which can be detected by the application. Notice that there is no explicit ”EOF character” at the end of a file. Similarly, a write operation copies Ñ ¼ bytes from memory to a file, starting at the current file position , and then updating . When an application is finished reading and writing the file, it informs the kernel by asking it to close the file. The kernel frees the structures it created when the file was opened and restores the descriptor to a pool of available descriptors. The next file that is open...
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