Progress
External Program
Interfaces
4GL Socket Event Model
The 4GL socket event model includes two types of 4GL events:
- CONNECT — Posted on a server socket object when a client seeks to establish a socket connection. As part of generating this event, Progress creates a socket object for the server to communicate with the client on the new connection.
- READ-RESPONSE — Posted on a socket object when data is available to be read on the socket.
Using Events To Connect and Communicate
Like all 4GL events, these CONNECT and READ-RESPONSE events are handled in the context of an I/O blocking or PROCESS EVENTS statement. Figure 1–8 shows how two 4GL applications, one acting as a socket server and the other as a socket client, can use these events to communicate across a single connection.
Figure 1–8: 4GL Socket Event Model
![]()
The server creates and enables a server socket object for listening on a specified port. The client creates a socket object and attempts to connect that socket to the server port used by the server socket. The server accepts the connection request and runs a specified CONNECT event procedure in response to the CONNECT event. This procedure receives a handle to a socket object that is implicitly created on the server for the connection. Once a connection is established, both the client and server can read and write data to each other using their connected socket objects.
The socket object that the client creates and the socket object created on the server in response to the CONNECT event both reference the same TCP/IP connection. Using the 4GL event model, the client and server can each receive notifications of data from the other within a READ-RESPONSE event procedure that runs in response to a READ-RESPONSE event on the socket object. The client can specify this event procedure any time after it creates its socket object. The server can specify this event procedure any time after it receives the socket object in the CONNECT event procedure.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |