Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 9 Virtual Circuits : Programming Paradigm

Programming Paradigm
These steps illustrate the programming paradigm for Rendezvous virtual circuits.
1.
2.
Program code in process B responds to one of those requests by creating a virtual circuit transport accept object. Creating the accept object also produces a connect subject—an inbox where the accept object listens for protocol messages.
3.
4.
Program code in process A creates a virtual circuit transport connect object—supplying the connect subject from the invitation as an argument to the create call.
5.
6.
When the connection is complete (that is, ready to use) both terminals present VC.CONNECTED advisories. From this time forward, either process can send messages on the virtual circuit.
 
Connect Subject
B must send the connect subject as the reply subject of the invitation message—not as an application-level field of the message. This detail is especially important when routing hardware or software intervenes between the two processes.
Request and Invitation
Notice that programs must send the request and invitation messages on transports that are already operational. They cannot send them on the virtual circuit transport, because the circuit is not yet complete.
Listening and Sending
Programs may create listener objects on virtual circuit transports at any time after the create call returns.
Attempting to send messages before the connection is complete produces error status.
Testing the New Connection
Code in both processes (A and B) must test the new connection before using it. Use the following two-part test. Immediately after creating a virtual circuit terminal object, do these two steps, in this order:
1.
Listen for the VC.CONNECTED advisory on the terminal transport object. If the terminal presents this advisory, it is ready to use.
It is possible to miss this advisory. That is, the terminal might present it before the program creates the listener to intercept it. In this situation, the program could wait indefinitely for the advisory, which has already come and gone. To avoid this situation, do the following step as well.
2.
 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved