The following are the session support commands:
The NCBCALL and NCBLISTEN commands establish a session between processes. One process issues the NCBLISTEN command to prepare to open a session. The other process issues the NCBCALL command to open the session. The remote computer must have an NCBLISTEN command pending. When the session is established, the NCBLISTEN command is completed and the calling process receives a local session number and the name of the remote session partner. In addition, the NCBCALL command is completed and the calling process receives a local session number in the ncb_lsn member of the NCB structure. The process of establishing a session is shown in the following illustration:
The NCBSSTAT command obtains the status of any sessions that were opened using the specified name. The ncb_buffer member receives a SESSION_HEADER structure, followed by one or more SESSION_BUFFER structures. The process of obtaining the session status is shown in the following illustration.
The NCBHANGUP command closes the session identified by the specified local session number, as shown in the following illustration.
This example assumes that there are NCBRECVANY commands pending on both computers.