RPC HELP DLL GuideLines C Connect to the Server
From VistApedia
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. RPCBPropSet(RPCBroker,"Server", "BROKERSERVER"); RPCBPropSet(RPCBroker, "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. RPCBPropSet(RPCBroker, "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. RPCBPropGet(RPCBroker, "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 = RPCBCreateContext(RPCBroker, "XWB EGCHO"); return result;