I'm learning about network programming in Unix and currently trying to understand the concept of socket and file descriptors. From what I have understood a file descriptor is simply a position in an array of pointers (File descriptor table?) and these pointers point to a file somewhere in memory.
Do socket descriptors share this array with file descriptors, but the pointer instead refers to a socket. Or is there something else that's only used for sockets?
Is this array unique to every application/process?
file) (in the kernel) and the set of flags (flags). Things like file read/write offset, are stored in the open file description, not the file descriptor table. All this means there's not one, but two levels of indirection at play here.