Progress
External Program
Interfaces


Detecting Data On a Socket

You can detect data on a socket using either the procedural or event-driven models.

Data Detection Using the Procedural Model

To detect data procedurally, you can simply read whatever data is available on the socket object using the READ( ) method. Using this model, you do not use the READ-RESPONSE event, and Progress does not automatically notify your application when data is available to read on the socket. You can also:

How you use these methods depends on your application requirements and the options that you choose on the READ( ) method. For more information on READ( ) method options, see the "Reading Data On a Socket" section.

Data Detection Using the Event-driven Model

To detect data using events, you set up an event handler for READ-RESPONSE events posted on a connected socket object. You can set up this event handler as follows:

  1. Define an internal procedure that takes no arguments to serve as an event procedure. You can define this procedure in any procedure context that is active during the connection. When this procedure executes in response to a READ-RESPONSE event, the SELF system handle returns the handle of the connected socket.
  2. Specify the procedure you defined in Step 1 as a READ-RESPONSE event procedure by invoking the SET-CONNECT-PROCEDURE( ) method on the socket.
  3. Include blocking I/O statements (such as WAIT-FOR) or PROCESS EVENTS statements in your code to initiate the handling of events. When any READ-RESPONSE event is received in the context of one of these statements, the event procedure specified in Step 2 executes.

In the event-driven model, Progress can post a READ-RESPONSE event on a connected socket object for two reasons:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095