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
Ifyouhaveexistingsocket‐basedapplications,onlyafewcodechangesarerequiredforVMCIsockets.Ifyou
donothavesocket‐basedapplications,youcaneasilyfindpublic‐domaincodeontheWeb.Forexample,
ApacheandFirefox,asshowninFigure 1‐1,“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)releasesandlaterhavecompleteuser‐levelsupportforVMCIsockets.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
earlierWindowsguests–C:\ProgramFiles\VMware\VMwareTools\VSockSDK\include
earlierWindowshosts–C:\ProgramFiles\VMware\VMwareWorkstation
Linuxguests–/usr/lib/vmware-tools/include/vmci
Linuxhosts–/usr/lib/vmware/include/vmci
ESX/ESXihosts–Notinstalledonthesystem.
I
MPORTANTTouseVMCIsockets,virtualmachinesmustbeupgradedtoVMwarecompatibility7(virtual
hardwar eversion7),whichwasintroducedinVMwareWorkstation6.5andsupportedinESX/ESXi4.0.