HP Rp7410 ACSE/Presentation and ROSE Interface Programmer's Guide - Page 56
Using Synchronous vs. Asynchronous
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 56 highlights
Programming Guide 4. Using Synchronous vs. Asynchronous Mode 4. Using Synchronous vs. Asynchronous Mode ACSE/Presentation supports both synchronous and asynchronous mode execution of calls. In synchronous mode, an ACSE/Presentation call blocks until the call can be completed. While blocked, no other tasks can be performed. Synchronous mode is the default. In asynchronous mode, an ACSE/Presentation call is not blocked (except under kernel resource shortages). The function completes as much of its task as it can, then returns to the user. Synchronous Mode Synchronous mode is useful for processes maintaining a single connection, and for processes that can wait for events to occur. When synchronous mode is used, ap_snd() blocks until resources are available to send the entire primitive. Similarly, ap_rcv() blocks until either an entire primitive is received, or the user buffer is filled by the library. In the latter case, ap_rcv() returns with the AP_MORE bit set in the flags argument. To receive the remaining data, the application must continue to call ap_rcv() until it returns with the AP_MORE bit reset. Asynchronous Mode Asynchronous mode is used for applications in which long delays are expected between events, and for processes that can perform other tasks while waiting for events to happen. Asynchronous mode is also useful for managing multiple connections concurrently. Asynchronous mode is specified in ap_open() by setting the O_NDELAY bit in the oflags parameter. When used asynchronously, ap_snd() and ap_rcv() do not block in most cases. If there are insufficient resources from OTS to send the entire primitive for an ap_snd(), a partial send can occur. A return code of -1 is received and ap_errno is set to AP_AGAIN. To complete sending the primitive, ap_snd() must be invoked again with the same set of buffers and arguments until the call returns successfully. 56 Chapter 4