Socket
Also called: network socket, listening socket, connected socket, socket API
A socket is a software endpoint through which an application uses communication services supplied by the operating system. Its address family and type determine how it behaves: an Internet stream socket commonly uses TCP, while a datagram socket commonly uses UDP. A socket is an API object, not a physical connector or just a port number.
For example, a TCP server binds a listening socket to a local address and port, then accepts an incoming connection. The accept operation returns a separate connected socket used to exchange bytes with that client. The listening socket can continue accepting other clients. Several connections can share the server’s port because their complete endpoint combinations distinguish them.
- Read first
- Transport port
- Further reading
- Python 3.15 socket documentation — Socket Objects