RPC HELP DLL GuideLines VB Connect to the Server

From VistApedia
Jump to: navigation, search

RPC Broker Help Home

DLL Interface Home

Visual Basic: Connect to the Server

To connect to the VistA M Server from your Visual Basic program:

1. Set the server and port to connect to:

   Call RPCBPropSet(intRPCBHandle, "Server", "BROKERSERVER")
   Call RPCBPropSet(intRPCBHandle, "ListenerPort", "9200")

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

   Call RPCBPropSet(intRPCBHandle, "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:

   RPCBPropGet(intRPCBHandle, "Connected", strResult)

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:

   intResult = RPCBCreateContext(intRPCBHandle, "MY APPLICATION")