Each socket may be in one of the following states:
Created – indicates that the socket exists.
Bound – indicates that the socket exists and is bound to a port; a "Bound socket" needs a listen queue which currently requires a WRITE /LISTEN [after a USE].
Connected – indicates that the socket exists and has a connection.
A server socket used for accepting new connections goes through the first two states in one step with a single OPEN or in two steps with an OPEN and a USE. When a server does a WRITE /WAIT on a Bound socket, a client can establish a connection which Creates another server socket that is Connected. In server operation, $KEY supplies the port value when a socket is bound (important when port 0 is specified to get the system to choose the port), and a socket id when a Connected socket is created. A client socket goes through the first and third states with a single OPEN or in two steps with an OPEN and a USE.