|
Socket Descriptors
- UNIX open yields a file descriptor:
a small integer used to read/write a file
- UNIX keeps a file descriptor table for each process
an array of pointers to data about open files
- A file descriptor is used to index the array
- Sockets are added to this abstraction
- The socket system call returns a socket descriptor
- Files and sockets are accessed using the same table
- The structure pointed to by a table entry has a field
which tells whether it is a file or socket.
|