I have found an answer to my question, and since it looks like nobody is going to answer it I'm gonna post the answer myself for people that might run into this problem in the future.
The problem was that I called VixHost_Connect
every time I ran the function, and because of that the function VixHost_OpenVM
would create a new (TCP) connection to the virtual machine every time. After a few calls, I'd reach the limit of TCP connection imposed by the operating system, and further calls to VixHost_OpenVM
would fail.
The solution is to call the function VixHost_Connect
in the initmodule()
function, and store the handle as a global variable that the other methods can use. After I've done this, my listProcesses()
function looks like this:
- VixHost_OpenVM
- VixVM_LoginInGuest
- VixVM_ListProcessesInGuest
- VixVM_LogoutFromGuest
Because I use the same handle to Vmware every time I run listProcesses()
, a TCP connection to the virtual machine is created only if one does not already exist, and I can call the function as many times as I want.