OnixS C++ FIX Engine  4.12.0
API Documentation
Establishing FIX Connection via Proxy

Often a counterparty requires that clients connect via a proxy for security reasons. In such cases, one can use OnixS::FIX::Session::proxySettings method to set the HTTP proxy parameters. These parameters will be used during the OnixS::FIX::Session::logonAsInitiator call to set up the proxy tunnel before the Logon exchange.

Example

using namespace OnixS::FIX;
const std::string SenderCompId = "SenderCompID";
const std::string TargetCompId = "TargetCompID";
// HTTP Proxy host.
const std::string ProxyHost = "192.22.33.1";
// HTTP Proxy port.
const int ProxyPort = 5000;
// HTTP Proxy user name if necessary.
const std::string ProxyUsername = "Username";
// HTTP Proxy password if necessary.
const std::string ProxyPassword = "Password";
// Counterparty host.
const std::string CounterpartyHost = "192.55.66.1";
// Counterparty port.
const int CounterpartyPort = 6000;
Listener listener;
Session initiator(SenderCompId, TargetCompId, Version, &listener);
// Sets HTTP proxy settings, which will be used in the `Session::logonAsInitiator` method
// to setup the proxy connection before the Logon exchange.
initiator.proxySettings(Session::ProxySettings(ProxyHost, ProxyPort, ProxyUsername, ProxyPassword));
// Establishes the proxy tunnel first and then performs the usual Logon exchange.
initiator.logonAsInitiator(CounterpartyHost, CounterpartyPort);
// Message exchanges and processing logic goes here as usual..
initiator.logout();