Establishing FIX Connection via Proxy |
Often a counterparty requires that clients connect via a proxy for security reasons.
In such cases, one can use Proxy settings to set the HTTP proxy parameters.
These parameters will be used during the LogonAsInitiator(String, Int32) call to set up the proxy tunnel before the Logon exchange.
Example using FIXForge.NET.FIX;
using FIXForge.NET.FIX.FIX44;
const string senderCompID = "SenderCompID";
const string targetCompID = "TargetCompID";
const ProtocolVersion version = ProtocolVersion.FIX44;
const string ProxyHost = "192.22.33.1";
const int ProxyPort = 5000;
const string ProxyUsername = "Username";
const string ProxyPassword = "Password";
const string CounterpartyHost = "192.55.66.1";
const int CounterpartyPort = 6000;
using (Session initiator =
new Session(targetCompID, senderCompID, version))
{
initiator.Proxy.Host = ProxyHost;
initiator.Proxy.Port = ProxyPort;
initiator.Proxy.Username = ProxyUsername;
initiator.Proxy.Password = ProxyPassword;
initiator.LogonAsInitiator(CounterpartyHost, CounterpartyPort);
initiator.Logout();
}