This is a broad question:
How do File descriptor, connection, socket, ip all relate to each other?
Is a file descriptor just a text file? And so when I make a connection to a server, does it mean the server and my computer basically create a file descriptor and we communicate through writing into the file?
Why servers have a limit of file descriptors? When a server opens up too many connections, it could fail with an error: too many files open. Is it because with each connection the server opens up a new text file?
An IP address is a "number" that identifies a machine in a network. So you can say "send this data to IP x.x.x.x" and the network knows which one is the destination machine. There are several ways to assign IP addresses to machines.
A connection is a conceptual link between two machines. It is conceptual because it is not necessary that the machines are directly wired to each other or anything: they are linked "through the network".
A socket is a programming interface that allows a programmer to manage connections, so the programmer can:
A file descriptor is an element (typically a number) that allows the programmer to identify a "stream" of data: files on disk, sockets, pipes, named pipes... basically anything you can read / write bytes in a sequential manner. They are called file descriptors because initially they identified files only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With