1.11. Connections Via a Proxy Server

Clients in a production environment are often behind a restrictive firewall. To connect to a server in the outside world this client must then connect via a proxy server. Sometimes the client even has to authenticate with the proxy with a user identifier and a password. ulxmlrpcpp supports both variants.

1.11.1. Transparently Using a Proxy Server

To turn on proxy usage within ulxmlrpcpp the following code is needed:


  TcpIpConnection conn (false, host, port);
  conn.setProxy("sonne", 8080); 1

  HttpProtocol prot(&conn);
  prot.setProxyAuthentication("proxyuser", "proxypassword");  2

1

Tell the Connection object which proxy server and port to use.

2

Pass the Protocol object the username and password for the proxy.