您的位置:首页 > 运维架构 > Linux

Common Tasks :Connecting to a Specified Host

2012-10-19 11:15 369 查看


Connecting to a Specified Host

This allows you to access any networked host machine that is running VMware Server from a single client machine. If the host is running VMware Workstation, you must use the procedure Connecting
to the Local Host as the Current User.

For clients connecting through a firewall, open ports 8222 and 8333 for VMware Server on Windows, or ports 80 and 443 for VMware Server on Linux, in addition to default port 902. This is assuming vmware-hostd listens on the default ports. If you changed
ports at installation time or with vmware-config.pl, open those ports instead.

Example 3-1.

C code below.
#include "vix.h"
 
int main(int argc, char * argv[])
{
VixHandle hostHandle = VIX_INVALID_HANDLE;
VixHandle jobHandle = VIX_INVALID_HANDLE;
VixError err;
 
// Connect to specified host.
jobHandle = VixHost_Connect(VIX_API_VERSION,
VIX_SERVICEPROVIDER_VMWARE_SERVER,
argv[1], // hostName
0, // hostPort
argv[2], // userName
argv[3], // 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;
}
Vix_ReleaseHandle(jobHandle);
jobHandle = VIX_INVALID_HANDLE;
// Other code goes here...
 
abort:
VixHost_Disconnect(hostHandle);
}


If you specify the host when you connect to VMware Server, you can also choose to specify the port number. The port number defaults to 902, which is correct for most installations
of VMware Server. Some installations might be configured to use a different port number, if port 902 is already in use on the host.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息