READ-RESPONSE event

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 method or procedure.

The SET-CALLBACK() method is used to name the READ-RESPONSE event method or procedure and to associate it with a socket object. The AVM invokes this method or 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 method or procedure, the SELF handle identifies the affected socket object.
Note: The SET-READ-RESPONSE-PROCEDURE () can also be used to name the event procedure, but this is only for procedures. The SET-CALLBACK() method can be used for both procedures and methods, and is preferable.

To determine if the event method or 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.