Receiving Data Asynchronously

With the Microsoft® Windows NT®, Microsoft® Windows® 95, Windows version 3.x, and OS/2 operating systems, a TP can receive data asynchronously, without regard to other events occurring within the TP. The following table shows the methods by which a TP can receive data asynchronously. The table also indicates how asynchronous methods can be applied to actions other than receiving data.

Operating system Method
Windows NT, Windows 95, or Windows 3.x Through a Windows message:
Issue RECEIVE_AND_WAIT or MC_RECEIVE_AND_WAIT with WinAsyncAPPC; the application is notified of completion through a PostMessage to the defined window handle.

This method is not restricted to RECEIVE_AND_WAIT and MC_RECEIVE_AND_WAIT, but can be applied to any APPC verb.

.

Windows NT or Windows 95 Through a Win32® event:
Issue RECEIVE_AND_WAIT or MC_RECEIVE_AND_WAIT with WinAsyncAPPCEx; the application is notified of completion through a Win32 event.

This method is not restricted to RECEIVE_AND_WAIT and MC_RECEIVE_AND_WAIT, but can be applied to any APPC verb.

Windows NT, Windows 95, or
OS/2
With RECEIVE_AND_POST or MC_RECEIVE_AND_POST:
Issue the RECEIVE_AND_POST or MC_RECEIVE_AND_POST verb. With OS/2, the application is notified of completion through a semaphore. With Windows NT and Windows 95, the application is notified of completion through a Win32 event (the unsignaled event, not a semaphore, is passed in the sema member).

The following list gives details about these methods of receiving data asynchronously. For complete information, see the verb descriptions.

RECEIVE_AND_WAIT or MC_RECEIVE_AND_WAIT with WinAsyncAPPC
This method is defined as part of Windows SNA. It allows an application to issue a verb and be notified through a PostMessage when the action is complete. To retrieve the message number that will be posted to the window, call RegisterWindowMessage with "WinAsyncAPPC" as the input string. Then issue RECEIVE_AND_WAIT or MC_RECEIVE_AND_WAIT using the WinAsyncAPPC entry point.
RECEIVE_AND_WAIT or MC_RECEIVE_AND_WAIT with WinAsyncAPPCEx
This method allows an application to be notified through a Win32 event. This is particularly useful when writing applications that need to service multiple conversations simultaneously. The event must be in the nonsignaled state when passed to APPC, and the handle must have EVENT_MODIFY_STATE access to the event.
RECEIVE_AND_POST or MC_RECEIVE_AND_POST
When using RECEIVE_AND_POST or MC_RECEIVE_AND_POST with Windows NT or Windows 95, the application is notified through a Win32 event. The event must be in the nonsignaled state when passed to APPC, and the handle must have EVENT_MODIFY_STATE access to the event.

When using RECEIVE_AND_POST or MC_RECEIVE_AND_POST with OS/2, the application is notified through a semaphore. Use DosSemSet to set the semaphore; APPC will clear the semaphore when the TP finishes receiving data asynchronously.

While receiving data asynchronously, the TP performs tasks not related to this conversation; the TP cannot issue most APPC verbs until notification is received. For information about the verbs that can be issued, see the descriptions of WinAsyncAPPC or WinAsyncAPPCEx.

After a verb has completed asynchronously, check the primary_rc to find out whether the data was received without error.

Note  If the initial call to issue the verb returns successfully, the application is guaranteed to be notified (by the applicable method) when the verb completes, regardless of whether the verb is ultimately successful.