Edges in this graph indicate order dependencies. Broadly, you may only legally use an operation if you have performed all the operations on some path to it, starting from "ø", the entry point. Error paths are not illustrated. Once created, a socket can be close'd at any time.
"Legally" here is intentionally somewhat imprecise. For example, most implementations will not report an error if you call recvmsg on a socket that has no address bound to it; however, no message will ever become available, and if non-blocking, the call will time out.
graph TD
O(("ø")) --> S
S --> GSO[getsockopt]
S --> SSO[setsockopt]
S[socket] --> B[bind]
S --> CL[close]
S --> TXM{{sendmsg}}
C --> TX{{send}}
C --> RX{{recv}}
C --> SD[shutdown]
S --> C[connect]
B --> L
S --> L[listen]
B --> RXM{{recvmsg}}
L --> A[accept]
A --> SD[shutdown]
A --> TX
A --> RX