Difference between revisions of "RPC HELP DLL GuideLines CPP Connect to the Server"

From VistApedia
Jump to: navigation, search
 
Line 23: Line 23:
 
     if (atoi(Value) != 1) return false;
 
     if (atoi(Value) != 1) return false;
  
'''4.''' Attempt to create context for your application's "B"-type option. If you can't create context, you should quit or branch accordingly. If ** [[RPC_HELP_DLL_ExportFN_RPCBCreateContext|RPCBCreateContext]] returns True, then you are ready to call all RPCs registered to your application's "B"-type option:
+
'''4.''' Attempt to create context for your application's "B"-type option. If you can't create context, you should quit or branch accordingly. If [[RPC_HELP_DLL_ExportFN_RPCBCreateContext|RPCBCreateContext]] returns True, then you are ready to call all RPCs registered to your application's "B"-type option:
  
 
     // Create Context for your application's option (in this case, XWB EGCHO).
 
     // Create Context for your application's option (in this case, XWB EGCHO).
 
     result = RPCInst.RPCBCreateContext("XWB EGCHO");
 
     result = RPCInst.RPCBCreateContext("XWB EGCHO");
 
     return result;
 
     return result;

Latest revision as of 16:02, 8 July 2015

RPC Broker Help Home

DLL Interface Home

C++: Connect to the Server

To connect to the VistA M Server from your C++ program:

1. Set the server and port to connect to:

   // Set the Server and Port properties to determine where to connect.
   RPCInst.RPCBPropSet("Server", server);
   RPCInst.RPCBPropSet("ListenerPort", "9200");

2. Set the Connected property to true; this attempts a connection to the VistA M Server:

   // Set the Connected property to True, to connect.
   RPCInst.RPCBPropSet("Connected", "1");

3. Check if you are still connected. If so, you can continue (your connection was made). If not, you should quit or branch accordingly:

   // If still connected, can continue.
   RPCInst.RPCBPropGet("Connected", Value);
   if (atoi(Value) != 1) return false;

4. Attempt to create context for your application's "B"-type option. If you can't create context, you should quit or branch accordingly. If RPCBCreateContext returns True, then you are ready to call all RPCs registered to your application's "B"-type option:

   // Create Context for your application's option (in this case, XWB EGCHO).
   result = RPCInst.RPCBCreateContext("XWB EGCHO");
   return result;