Protocols
Saved & recent

Protocol state machine

Also called: finite-state machine, FSM

A protocol state machine describes which events are valid in each state and how processing an event changes that state. Events can include received messages, application actions, and timers. The same incoming message may therefore require different handling before and after a connection is established.

Consider a hypothetical session with disconnected, connecting, and ready states. A successful handshake moves connecting to ready; a timeout returns it to disconnected. Drawing these transitions makes missing failure paths visible. Real protocols may have separate state machines for connections and individual streams, so a three-state sketch is only a teaching model.

Read first
Protocol
Related
TCP handshake, Timeout, Protocol conformance
Further reading
IETF RFC 9293 — Transmission Control Protocol (TCP)
Disconnected Connecting Ready connectbegin accepted timeout close hypothetical session
Hypothetical session state machine. Event labels explain why a transition occurs; actual protocols often need more states.

View in the full Protocols collection