Asynchronous Call Completion
With one exception, Microsoft® Host Integration Server permits one outstanding Windows® SNA asynchronous call per connection and one blocking verb per thread. The exception to this is that when issuing an asynchronous Receive call, the following calls can be issued while the Receive is outstanding:
-
This enables an application, in particular a 5250 emulator, to use an asynchronous Receive to receive data. Use of this feature is strongly recommended.
The following example illustrates how to use asynchronous call completion with Host Integration Server:
void ProcessVerbCompletion (WPARAM wParam LPARAM lParam)
{
for ( i = 0; i<nPendingVerbs; i++ )
if (memcmp (pPending [i].ConvID, (Conversation_ID) lParam)== 0)
ProcessCommand (wParam, lParam);
}
LRESULT CALLBACK SampleWndProc ( . . .)
{
if (msg = = uAsyncCPIC ) {
ProcessVerbCompletion (wParam, lParam);
}
else switch (msg) {
case WM_USER:
Initialize_Conversation (lpConvId, "GORDM", &lError );
if (lError ! = CM_OK ) {
ErrorDisplay ( ) ;
break ;
}
Set_Processing_Mode (lpConvId, CM_NON_BLOCKING, &lError ) ;
if ( lError ! = CM_OK ) {
ErrorDisplay ( ) ;
break ;
}
Allocate (lpConvId, &lError ) ;
switch (lError ) {
case CM_OK:
break ;
case CM_OPERATION_INCOMPLETE:
memcopy (pPending [nPending ++].ConvId, lpConvId, sizeof (C) ;
break ;
default:
ErrorDisplay ( ) ;
}
break ;
}
WinMain ( . . . )
{
if ( ( WinCPICStartup ( . . . ) = = FALSE ) {
return FALSE;
}
uAsyncCPIC = RegisterWindowMessage ("WinAsyncCPIC"");
Specify_Windows_Handle (hwndSample) ;
while (GetMessage ( . . . ) ) {
. . . . .
}
WinCPICCleanup ( . . . )
}
For more information about CPI-C calls and Windows extensions, see CPI-C Calls and Extensions for the Windows Environment. For additional information about using CPI-C, see the IBM Systems Application Architecture Common Programming Interface Communications Reference, part number SC26-4399-04.