AVM Detects — Data is available on a socket or the remote end of a connection has closed its socket; applies only to socket objects.
AVM Action — The AVM invokes the READ-RESPONSE event procedure.
The SET-READ-RESPONSE-PROCEDURE( ) method is used to name the READ-RESPONSE event procedure and to associate it with a socket object. The AVM invokes this procedure whenever it detects that data is available on the socket or that the remote end of the socket has closed its end of the socket. In this procedure, the SELF handle identifies the affected socket object.
To determine if the event procedure was invoked because data is available for reading or because of a disconnect, the application can use one of several methods:
The CONNECTED( ) method returns FALSE if the socket is not connected to a port, TRUE if it is connected.
The GET-BYTES-AVAILABLE( ) method returns zero if the socket is not connected to a port or the number of bytes available for reading if it is connected.
The READ( ) method returns FALSE if the socket is not connected to a port. It returns TRUE and the read data if it is connected.