In the deferred synchronous model, the Client application issues a server request call and then continues immediately with the next statement without waiting for a reply.
Unlike the asynchronous case, where a server reply is handled immediately it arrives, the client decides when it wants to poll for a reply.
When a poll is issued, the flow object checks whether there is, in fact, a reply from the original server request. If there is, the flow object's reply handler is called synchronously and is passed the returned communication area in a buffer object. Poll returns a value to its caller indicating whether the reply was received or not; if not it can try again later.
…
MyCclECI myeci;
CclConn server1( argv[1],argv[2],argv[3] );
CclBuf comma1( argv[4] );
MyCclFlow dsflow( Ccl::dsync );
server1.link( dsflow,"ECIWTO",&comma1 );
…
…
Ccl::Bool reply = Ccl::no;
while ( reply == Ccl::no ) {
cout << "DSync polling…" << endl;
reply = dsflow.poll();
if ( reply == Ccl::no ) DosSleep( msecs );
}
…
DSync polling…
DSync polling…
DSync polling…
Reply from CICS server: Hello World
As in the asynchronous model, the wait method can be used to make a deferred synchronous flow synchronous, blocking the client.