CHAPTER 3 Operations on Host Machines
23
RC1
the job is signaled, the host handle is stored as the
VIX_PROPERTY_JOB_RESULT_HANDLE property of the job object.
• To specify the local host (where the API client runs), pass null values for the
hostName, hostPort, userName, and password parameters. This is shown in the
example below.
• If you are already connected to the host, a subsequent call to
VixHost_Connect() succeeds if you connect as the same user and use the
same host name. Subsequent calls return the same handle value.
• When you initialize the host object, you can also control some VIX operations
with the options parameter. The following options are supported:
• VIX_HOSTOPTION_USE_EVENT_PUMP — All asynchronous event
processing will be done when the client calls Vix_PumpEvents(). The
client is responsible for regularly calling Vix_PumpEvents(), such as in an
event loop.
Example
int main()
{
VixHandle hostHandle = VIX_INVALID_HANDLE;
VixHandle jobHandle = VIX_INVALID_HANDLE;
VixError err;
jobHandle = VixHost_Connect(VIX_API_VERSION,
VIX_SERVICEPROVIDER_VMWARE_SERVER,
NULL, // hostName
0, // hostPort
NULL, // userName
NULL, // password,
0, // options
VIX_INVALID_HANDLE, // propertyListHandle
NULL, // callbackProc
NULL); // clientData
err = VixJob_Wait(jobHandle,
VIX_PROPERTY_JOB_RESULT_HANDLE,
&hostHandle,
VIX_PROPERTY_NONE);
if (VIX_OK != err) {
// Handle the error...
goto abort;
}
printf("Connected to local host.\n");
abort:
Vix_ReleaseHandle(jobHandle);