Danilo Danilo - 5 months ago 26
C++ Question

C++: stop RPC service

from my C++ source, I am starting an RPC service calling

. Everything looks just fine and I can see my service running if I type
rpcinfo -p
in my terminal.

Now I am working on a "cleanup" function which should stop this service and remove it from the
rpcinfo -p

How can I do that? At the moment I am only able to stop it using
sudo rpcinfo -d program version
in my terminal. How can I do this from my source file?


Answer Source

After some time, I found out how to do this. Actually I faced some unexpected difficulties. The standard way to do this would be to use this:

svc_unregister(PROGID, VERSION)

but somehow, it did not work for me. After lots of trial and some online help (http://www.spinics.net/lists/linux-nfs/msg05619.html) I was able to delete the RPC service calling:

pmap_unset(PROGID, VERSION);

Hope this will help :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download