3 added 20 characters in body
source | link
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down. Regarding read and write they match other file descriptors which relate to regular files, named pipes, anonymous pipes etc but the creating of the file descriptor is different and there are some more operations on the file descriptor compared to for example regular files.
  2. A port number in TCP and UDP is an integer between 1 and 65535. The word "port" is used as short for "port number". The tuple of IP address and port number and protocol describes the endpoint address. Calling it port instead will cause confusion when reading other literature.
  3. An unconnected (but already bound) socket represents only a single endpoint (ip,port,protocol). A connected socket represents a local endpoint and another (local or remote) endpoint, i.e. a connection. One cannot have multiple in-kernel sockets for the same connection but one can have multiple file descriptors for the same in-kernel socket. One can have the same endpoint in multiple connected sockets but not for the same connection, i.e. the other endpoint of the connection must be different. One can actually have multiple unconnected sockets representing the same endpoint but this is very unusual.
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child. But it is not possible that one process creates a new socket (instead of sharing an existing one) which represents exactly the same connection as an existing socket on the same system.
  5. Two sockets/connections can share the same port on one endpoint but they cannot share both endpoints, i.e. at least one of source IP, source port, destination IP, destination port or protocol needs to be different.
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down. Regarding read and write they match other file descriptors which relate to regular files, named pipes, anonymous pipes etc but the creating of the file descriptor is different and there are some more operations on the file descriptor compared to for example regular files.
  2. A port number in TCP and UDP is an integer between 1 and 65535. The word "port" is used as short for "port number". The tuple of IP address and port number and protocol describes the endpoint address. Calling it port instead will cause confusion when reading other literature.
  3. An unconnected socket represents only a single endpoint (ip,port,protocol). A connected socket represents a local endpoint and another (local or remote) endpoint, i.e. a connection. One cannot have multiple in-kernel sockets for the same connection but one can have multiple file descriptors for the same in-kernel socket. One can have the same endpoint in multiple connected sockets but not for the same connection, i.e. the other endpoint of the connection must be different. One can actually have multiple unconnected sockets representing the same endpoint but this is very unusual.
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child. But it is not possible that one process creates a new socket (instead of sharing an existing one) which represents exactly the same connection as an existing socket on the same system.
  5. Two sockets/connections can share the same port on one endpoint but they cannot share both endpoints, i.e. at least one of source IP, source port, destination IP, destination port or protocol needs to be different.
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down. Regarding read and write they match other file descriptors which relate to regular files, named pipes, anonymous pipes etc but the creating of the file descriptor is different and there are some more operations on the file descriptor compared to for example regular files.
  2. A port number in TCP and UDP is an integer between 1 and 65535. The word "port" is used as short for "port number". The tuple of IP address and port number and protocol describes the endpoint address. Calling it port instead will cause confusion when reading other literature.
  3. An unconnected (but already bound) socket represents only a single endpoint (ip,port,protocol). A connected socket represents a local endpoint and another (local or remote) endpoint, i.e. a connection. One cannot have multiple in-kernel sockets for the same connection but one can have multiple file descriptors for the same in-kernel socket. One can have the same endpoint in multiple connected sockets but not for the same connection, i.e. the other endpoint of the connection must be different. One can actually have multiple unconnected sockets representing the same endpoint but this is very unusual.
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child. But it is not possible that one process creates a new socket (instead of sharing an existing one) which represents exactly the same connection as an existing socket on the same system.
  5. Two sockets/connections can share the same port on one endpoint but they cannot share both endpoints, i.e. at least one of source IP, source port, destination IP, destination port or protocol needs to be different.
2 added 583 characters in body
source | link
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down. Regarding read and write they match other file descriptors which relate to regular files, named pipes, anonymous pipes etc but the creating of the file descriptor is different and there are some more operations on the file descriptor compared to for example regular files.
  2. A port number in TCP and UDP is an integer between 1 and 65535. A pairThe word "port" is used as short for "port number". The tuple of IP address and port describes an endpoint. A tuple of source ip+portnumber and destination ip+portprotocol describes a connection. A socket is only the API which lets an application create such endpoint and transfer data to another endpoint address. Calling it port instead will cause confusion when reading other literature.
  3. A port is no such tuple,An unconnected socket represents only a connection issingle endpoint (don't use established words with different meaningsip,port,protocol). A TCP socket can be a listener which accepts connections from anywhere to a local endpoint or it can be a connected socket which describes a connection fromrepresents a local toendpoint and another (local or remote) endpoint, i. With UDPe. a singleconnection. One cannot have multiple in-kernel sockets for the same connection but one can have multiple file descriptors for the same in-kernel socket might be used to send from a local endpoints to. One can have the same endpoint in multiple other endpoints since UDP doesconnected sockets but not really havefor the conceptsame connection, i.e. the other endpoint of an establishedthe connection must be different. One can actually have multiple unconnected sockets representing the same endpoint but this is very unusual. 
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child. But it is not possible that one process creates a new socket (instead of sharing an existing one) which represents exactly the same connection as an existing socket on the same system. 
  5. Two sockets/connections can share the same port on one endpoint but they cannot share all four parts of the tupleboth endpoints, i.e. at least one of source IP, source port, destination IP, destination port needor protocol needs to be different.
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down.
  2. A port in TCP and UDP is an integer between 1 and 65535. A pair of IP and port describes an endpoint. A tuple of source ip+port and destination ip+port describes a connection. A socket is only the API which lets an application create such endpoint and transfer data to another endpoint.
  3. A port is no such tuple, a connection is (don't use established words with different meanings). A TCP socket can be a listener which accepts connections from anywhere to a local endpoint or it can be a connected socket which describes a connection from a local to another endpoint. With UDP a single socket might be used to send from a local endpoints to multiple other endpoints since UDP does not really have the concept of an established connection.
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child.
  5. Two sockets/connections can share the same port on one endpoint but they cannot share all four parts of the tuple, i.e. at least one of source IP, source port, destination IP, destination port need to be different.
  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down. Regarding read and write they match other file descriptors which relate to regular files, named pipes, anonymous pipes etc but the creating of the file descriptor is different and there are some more operations on the file descriptor compared to for example regular files.
  2. A port number in TCP and UDP is an integer between 1 and 65535. The word "port" is used as short for "port number". The tuple of IP address and port number and protocol describes the endpoint address. Calling it port instead will cause confusion when reading other literature.
  3. An unconnected socket represents only a single endpoint (ip,port,protocol). A connected socket represents a local endpoint and another (local or remote) endpoint, i.e. a connection. One cannot have multiple in-kernel sockets for the same connection but one can have multiple file descriptors for the same in-kernel socket. One can have the same endpoint in multiple connected sockets but not for the same connection, i.e. the other endpoint of the connection must be different. One can actually have multiple unconnected sockets representing the same endpoint but this is very unusual. 
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child. But it is not possible that one process creates a new socket (instead of sharing an existing one) which represents exactly the same connection as an existing socket on the same system. 
  5. Two sockets/connections can share the same port on one endpoint but they cannot share both endpoints, i.e. at least one of source IP, source port, destination IP, destination port or protocol needs to be different.
1
source | link

  1. Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as you write) provide similar functionality for communicating with applications on the same system only. The concepts for both are similar: the API provides ways to create a socket, bind, listen+accept and connect a socket, to read and write on it and to shut it down.
  2. A port in TCP and UDP is an integer between 1 and 65535. A pair of IP and port describes an endpoint. A tuple of source ip+port and destination ip+port describes a connection. A socket is only the API which lets an application create such endpoint and transfer data to another endpoint.
  3. A port is no such tuple, a connection is (don't use established words with different meanings). A TCP socket can be a listener which accepts connections from anywhere to a local endpoint or it can be a connected socket which describes a connection from a local to another endpoint. With UDP a single socket might be used to send from a local endpoints to multiple other endpoints since UDP does not really have the concept of an established connection.
  4. Sockets can be shared between processes since sockets are file descriptors and file descriptors can be shared. Sharing is typically done by forking, i.e. the parent opens some file or socket and the child inherits it. But there are also ways to send a file descriptor/socket from one process to another. Sharing means that both can write and read but no data will be duplicated, i.e. if the parent reads some data these data are taken from the socket and cannot be also read by the child.
  5. Two sockets/connections can share the same port on one endpoint but they cannot share all four parts of the tuple, i.e. at least one of source IP, source port, destination IP, destination port need to be different.