The Asynchronous API
All generated proxies contain both synchronous and asynchronous service operation methods. When you use the proxy, you simply select either the synchronous or the asynchronous method.
The asynchronous methods return an instance of
rwsf::AsyncHandle. This class launches a thread that runs the operation, and the response blocks until it is ready. While the method is running, the main thread does not block and is free to perform other tasks.
An asynchronous client can make multiple asynchronous calls on the proxy. Each call uses a single transport with a single connection to the server. This design gives you full control over transport creation and avoids the case in which multiple transports are created automatically outside of your control.
NOTE: It is important to understand that your client must wait for the transport to return from the previous operation before the next one is sent to the server.
To achieve full asynchronous behavior, you may want to create separate proxies, so that each one has its own connection to the server.
The asynchronous class architecture is illustrated in
Figure 7.