The application endpoint
A port names a destination. A socket gives the application a handle.
A networked application does not send data to a port in isolation. It uses a socket supplied by the operating system. The socket connects the application to a transport protocol and to an endpoint such as 192.0.2.10:443.
A server socket can listen for incoming conversations. A client socket can connect to that service, exchange data, and close when the conversation is finished.
Build the model
Four ideas that make a socket useful
Address
Identifies the host endpoint, such as an IPv4 or IPv6 address.
Port
Identifies the service or process that should receive transport data.
Transport
Defines the conversation contract, such as TCP's reliable stream or UDP's datagrams.
State
Describes whether the socket is listening, connecting, established, or closing.
Mini experiment
Build a socket conversation
Follow the steps from a listening service to a closed conversation. The endpoint details change as the socket gains state.
0.0.0.0:443-The server has bound to port 443 and is waiting for a client connection.
Knowledge check
Test your socket model
Answer seven questions. The answer order changes each time.