Creating a Binding Handle

The client program of a distributed application needs to create a binding handle that tells the RPC run time which server should be contacted, and how the server should be contacted.

The following code fragment demonstrates a common approach to creating a binding handle:

RPC_STATUS status;
unsigned short *StringBinding;
status = RpcStringBindingCompose(NULL,  // Object UUID
             L"ncacn_ip_tcp",           // Protocol sequence to use
             L"", // Server DNS or Netbios Name
// Error checking ommitted. If no error, we proceed below
status = RpcBindingFromStringBinding(StringBinding, &BindingHandle);

// free string regardless of errors from RpcBindingFromStringBinding

// Error checking ommitted. If no error, we have a valid binding handle