Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Navigation: Subroutines > TCPX

Status (TCPX)

Scroll Prev Top Next More

This table lists details relating to the interpretation of the status parameter, based on the opcode.

Symbol

Interpretation of Status Returned

TCPOP_ACCEPT

Status >= 0 indicates success. Any value > 0 implies that you had data in the buffer parameter, which was sent unsolicited to the client - up to 32 bytes. That is an unusual protocol though, and likely to confuse the client.

TCPOP_WRITE

Status returns the number of bytes written. <0 indicates an error. Note that for non-blocking connections, a special error value (EWOULDBLOCK, which is -10035 for Windows and typically -11 for Unix) is returned if the socket cannot accept the data immediately. All other errors would suggest a permanent problem requiring the socket to be closed.

TCPOP_READ

Status returns the number of bytes read. <0 indicates an error. See note above for TCPOP_WRITE about the special EWOULDBLOCK error.

TCPOP_SHUTDOWN

Returns 0 for success, <0 for error.

TCPOP_CLOSE

Returns 0 for success, <0 for error.

TCPOP_CHECK

Returns 0 to indicate that the socket is not ready—that is, there is no data to read, or, in the case of Asynchronous Client Connections, the socket is not yet connected. <0 indicates an error; probably the socket has been closed at the other end, or the asynchronous connection attempt failed. 1 indicates that the socket has data to read, or the asynchronous connection has successfully completed.

TCPOP_CHKQTY

Returns the number of bytes available to read, or <0 for an error.

TCPOP_CONNECT

Returns 0 for a successful normal connection, else <0 for error. In the case of Asynchronous Client Connections, 0 indicates that the connection attempt is in progress, while 1 indicates that it connected successfully.

TCPOP_ERRMSG

Status should be set to the error code (probably returned from the previous operation) in order to get the error description. This is the one case where status is used for input to the subroutine rather than output from it.