OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
handles with the manager thread.
16.1.4.2 Transitioning from Client to Server to Client
Immediately before the program changes from a client to a server, it must obtain a handle
on its environment as a client by calling rpc_ss_get_thread_handle(). When it reverts
from a server to a client, it must reestablish the client environment by calling the
rpc_ss_set_thread_handle( ) routine, supplying the previously obtained handle as a
parameter.
16.2 Guidelines for Error Handling
During a remote procedure call, server and communications errors may occur. These
errors can be handled using any or all of the following methods:
Writing exception handler code to recover from the error or to exit the application
Using the fault_status attribute in the ACF to report an RPC server failure
Using the comm_status attribute in the ACF to report a communications failure
Use of exceptions, where the procedure exits the program due to an error, tends to
improve code quality. It does this by making errors obvious because the program exits at
that point, and by lessening the amount of code needed to detect error conditions and
handle them. When you use the fault_status attribute, an exception that occurs on the
server is not reported to the client as an exception. The variable to which the
comm_status attribute is attached contains error codes that report errors that would not
have occurred if the application were not distributed over a communications network.
The comm_status attribute provides a method of handling RPC errors without using an
exception handler.
16.2.1 Exceptions
Exceptions report either RPC errors or errors in application code. Exceptions have the
following characteristics:
You do not have to adjust procedure declarations between local and distributed code.
You can distribute existing interfaces without changing code.
You do not have to check for failures. This results in more robust code because
errors are reported even if they are not checked.
Your code is more efficient when there is no recovery coded for failures.
16 6 Tandem Computers Incorporated 124245