9.0

Table Of Contents
VMCI Sockets Programming Guide
8 VMware, Inc.
Persistence of Sockets
VMCIsocketsloseconnectionaftersuspendandresumeofavirtualmachine.
InVMwarevSpherewithESX/ESXihostsandvCenterServer,VMCIsocketsdonotsurvivelivemigrationwith
VMwarevMotion™fromsourcetodestinationhost.InVMwarevSpherewithESX/ESXihosts,VMCIstream
socketconnectionsaredroppedwhenavirtualmachineisputintofaulttolerance(F
T)mode.NonewVMCI
streamsocketconnectionscanbeestablishedwhileavirtualmachineisinFTmode.
Socket Programming
Ifyouhaveexistingsocketbasedapplications,onlyafewcodechangesarerequiredforVMCIsockets.Ifyou
donothavesocketbasedapplications,youcaneasilyfindpublicdomaincodeontheWeb.Forexample,
ApacheandFirefox,asshowninFigure 11,“ESXihostwithStreamVMCISocketsan
dRabbitMQ,”onpage 9,
usestreamsocketsandareopensource.
RepurposinganetworkingprogramtouseVMCIsocketsrequiresminimaleffort,becauseVMCIsockets
behaveliketraditionalInternetsocketsonagivenplatform.However,somesocketoptionsdonotmakesense
forcommunicationacrosstheVMCIdevice,sotheyaresi
lentlyignoredtopromoteprogramportability.
Modificationisstraightforward.Youincludeaheaderfile,changetheprotocoladdressfamily,andallocatea
newdatastructure.OtherwiseVMCIsocketsusethesameAPIasBerkeleysocketsorWindowssockets.See
“PortingExistingSocketApplications”onpage 11foradescriptionofthemodificationsneed
ed.
Features in Specific VMware Releases
VMCIsocketscommunicatebetweenthehostandaguestonVMwareplatformproducts.Youcouldalsouse
VMCIsocketsforinterprocesscommunicationsonaguest.YoucannotuseVMCIsocketsbetweenthehostand
avirtualmachinerunningonadifferenthost.
AsofVMwareServer2.0RC2andWorkstation6.5RCre
leases,youcansettheminimum,maximum,and
defaultsizeofcommunicatingstreambuffers.See“SetandGetSocketOptions”onpage 14.
ESX/ESXi4.x(vSphere4)releasesandlaterhavecompleteuserlevelsupportforVMCIsockets.Datagramand
streamsocketsaresupportedbetweenhostandguestsonbothLinuxandWi
ndows.IntheWorkstation7.x
releasesrunningonWindowshosts,onlydatagramsocketsweresupported.
IntheESXi5.0andWorkstation8.0releases,itwasannouncedthattheguesttoguestVMCIsocketsfeature
wouldbediscontinued.AsoftheESXi5.1release,onlyhosttoguestVMCIsock etsareallow
ed.
Enabling and Finding VMCI Sockets
Forhosttoguestcommunication,VMCIisenabledonvirtualmachineswithversion7compatibilityandlater.
Location of Include File for C Programs
VMwareToolsoranotherinstallerplacesthevmci_sockets.hincludefileinoneofthefollowinglocations:
WindowsguestsonWorkstation8.0orlater,andWindowshostsofWorkstation8.0orlater
C:\Program Files\Common Files\VMware\Drivers\vmci\sockets\include
earlierWindowsguestsC:\ProgramFiles\VMware\VMwareTools\VSockSDK\include
earlierWindowshostsC:\ProgramFiles\VMware\VMwareWorkstation
Linuxguests/usr/lib/vmware-tools/include/vmci
Linuxhosts/usr/lib/vmware/include/vmci
ESX/ESXihostsNotinstalledonthesystem.
I
MPORTANTTouseVMCIsockets,virtualmachinesmustbeupgradedtoVMwarecompatibility7(virtual
hardwar eversion7),whichwasintroducedinVMwareWorkstation6.5andsupportedinESX/ESXi4.0.