I am using xmlrpc-c library (c++ version) to write a program. I find that there is no way to configure the xmlrpc server’s host. I can only configure the port like below. Can anyone tell me how to configure the hostname for this server?
xmlrpc_c::registry myRegistry;
xmlrpc_c::defaultMethodPtr const XMLRPCMethodP(handler);
//myRegistry.addMethod("method", XMLRPCMethodP);
myRegistry.setDefaultMethod(XMLRPCMethodP);
webServer = new serverAbyss(xmlrpc_c::serverAbyss::constrOpt()
.registryP(&myRegistry)
.logFileName("/tmp/xmlrpc_log")
.portNumber(8183)
.uriPath("/")
); // Currently, there is no way to configure Host here.
try {
webServer->run();
} catch (std::exception &e) {
cout << e.what() << endl;
}
This is a server, so it listens for connections on the given port on the machine you are running it on. Giving it a hostname does not make much sense. You can, of course, specify a host to connect to on the client, see here. Or you are talking about binding the server to a particular network interface? I don’t think the library supports that.
Edit 0:
I think you should be able to use the
socketFdandsocketBoundoptions if you need to listen on given interface – create your own socket, bind it to whatever, pass it to the API. That’s just from looking at their source, so I have no idea if this actually works.