2. OPEN
By invoking this subprogram, the user requests that the specified local socket be removed from the closed state and thus be prepared to participate in data transfer. There are three distinct operations that can be performed by this subprogram, and these are described below:
(A) CONNECT
By initiating this operation, the user requests that the specified local socket be logically connected to the specified foreign socket, and that data transfer between the two sockets be enabled. The subprogram will wait until the foreign socket either accepts or rejects the connection attempt. This operation is valid only when the socket is in the closed state.
The calling sequence is as follows:
CALL @OPEN(cmpcd, time, lclsck, fgnsck, ws);
where
cmpcdis the completion code variable to be associated with the local socket.timeis the length of time the subprogram is to wait for the completion of the operation.lclsckis the socket identifier of the local socket.fgnsckis the socket identifier of the foreign socket.wsis a workspace which has the same attributes as a socket identifier, and, if the operation is successful, will become associated with the local socket for the life of the connection. In response to certain future operations, information may be returned to the programmer in this workspace.
The following completion codes are possible for this operation:
| Code | Description |
|---|---|
| 0 | The operation was successful and the connection has been established |
| 4 | The specified completion code variable is already assigned to a socket; the operation was suppressed |
| 8 | The specified local socket is not in the closed state; the operation was suppressed |
| 12 | All communication paths to the specified foreign site are in use; the operation was suppressed |
| 16 | Local resources are insufficient to support another connection; the operation was suppressed |
| 20 | The connection attempt was rejected by the foreign process |
| 24 | The specified local socket is not local to UCSB; the operation was suppressed |
| 28 | The specified foreign site is invalid; the operation was suppressed |
| 32 | An addressing or protection exception was encountered with respect to the specified workspace; the operation was suppressed |
| 36 | Either hardware at the foreign site is inoperative or the NCP's counterpart at the foreign site does not exist or has failed |
| 40 | Local and foreign sockets are both either send or receive sockets; the operation was suppressed |
| 44 | By operator command, all Network operations were terminated; the socket will be closed |
| 60 | An NCP control transmission error occurred; the operation was suppressed |
| 252 | The specified time limit was exceeded; the operation was initiated but not completed |
(B) LISTEN
This operation is a request for notification of any connection attempt directed toward the specified local socket. The subprogram waits until such a call is received, at which time the calling process' socket identifier is returned to the calling program. This operation is valid only when the designated local socket is in the closed state.
The calling sequence is as follows:
CALL @OPEN(cmpcd, time, lclsck, ws);
where
cmpcdis the completion code variable to be associated with the local socket.timeis the length of time the subprogram is to wait for the completion of the operation.lclsckis the socket identifier of the local socket.wsis a workspace which, if the operation is successful, will contain the socket identifier of the calling socket, and will become associated with the local socket for the life of the connection.wshas the same attributes as a socket identifier.
The following completion codes are possible for this operation:
| Code | Description |
|---|---|
| 0 | The operation was successful and a call has been received |
| 4 | The specified completion code variable is already assigned to a socket; the operation was suppressed |
| 8 | The specified local socket is not in the closed state; the operation was suppressed |
| 12 | Local resources are insufficient to support another connection; the operation was suppressed |
| 16 | The specified local socket is not local to UCSB; the operation was suppressed |
| 20 | An addressing or protection exception was encountered with respect to the specified workspace; the operation was suppressed |
| 44 | By operator command, all Network operations were terminated; the socket will be closed |
| 252 | The specified time limit was exceeded; the operation was initiated but not completed |
(C) ACCEPT
This operation accepts connection with the foreign socket whose call caused successful completion of a previous LISTEN operation by the specified local socket. After completion of this operation, data may be transferred to or from the local socket, depending on its gender. This operation is valid only when the last operation referencing the local socket was a LISTEN operation. The subprogram will wait until the operation is completed.
The calling sequence is as follows:
CALL @OPEN(cmpcd, time);
where
cmpcdis the completion code variable associated with the local socket by a previous LISTEN operation.timeis the length of time the subprogram is to wait for the completion of the operation.
The following completion codes are possible for this operation:
| Code | Description |
|---|---|
| 0 | The operation was successful, and the connection is established |
| 4 | The specified local socket is in the closed state (the NCP may have received an abort notification from the foreign process); the operation was suppressed |
| 8 | The previous operation specifying the designated local socket was not a LISTEN; the operation was suppressed |
| 12 | All communication paths to the specified foreign site are in use; the socket has been returned to the closed state |
| 252 | The specified time limit was exceeded; the operation was initiated but not completed |