LSNG, RFCS and RFCR States
State 03 - LSNG - Listening for RFC
In this state, no network activity has occurred. The local program is, however, waiting for some attempt at connection. This state does not time out (event TIME loops into LSNG). The program may decide to stop listening (e.g., it may simply log out of TENEX) so events CLZR and CLZS move the connection to state FREE. The desired event is the receipt of an RFC for this socket. When an RFC arrives for a socket in a state other than CLZD, it is checked to see that the byte size matches that declared by the user program. It then becomes event RRFC if the byte size matches, or RRFB if it does not match. RRFB causes a LSNG socket to go to state CLSW and a CLS to be sent, refusing the connection. In the normal case, event RRFC steps the connection to state RFCR.
State 06 - RFCS - An RFC has been sent.
This state is entered when a program does a Connect (an OPENF with a specific foreign socket). The RFC has been sent, and the matching RFC is awaited. If the foreign site refuses the request for connection, sending a CLS, events CLSR and CLSS cause the matching CLS to be sent (ACLS) and the socket is stepped to FREE state. If the user program gives up waiting for the acceptance of the connection (events CLZS or CLZR), a timeout happens (TIME) or an RFC arrives but has the wrong byte size (RRFB), the socket is stepped to CLSW and a CLS is sent (ACLS). In the case of a properly accepted connection (event RRFC), the link tables are opened (AOPL) and the connection state goes to OPND.
State 04 - RFCR - An RFC has been received.
This state is reached when a Listen has been done by the user, and an RFC (with matching byte size) has been received. This state and the PNDG state make up the queueing mechanism for received RFC's. Queued RFC's in PNDG state are for sockets which are not listening (although another connection with the same socket number may have been listening -- this is just not the first one), so they time out after two minutes. In RFCR, though, a program has done a listen. Therefore, timeouts are suppressed to allow the accept to be done (event TIME loops to RFCR).
If the foreign site tires of waiting for the accept, it may send a CLS (events CLSR or CLSS) in which case the matching CLS is sent (ACLS) and the socket moves to state FREE.
Also, while in this state, the program may examine the foreign host and socket and decide to refuse the connection by doing a CLOSF (events CLZR and CLZS). This causes a CLS to be sent (action ACLS) and the socket steps to CLSW to await the matching CLS.
If the program likes the request for connection, it will accept it with an MTOPR JSYS (event ACPT), causing action AOPB (sending the matching RFC and opening the link tables), and the socket steps to state OPND.