Establishing FIX Connection via Proxy
Use the Proxy settings to establish the FIX Connection via a proxy server.
The Engine will use these settings during the LogonAsInitiator(string, int, int, bool, IMessage, bool) call to set up the proxy tunnel.
The Engine supports Web and SOCKS proxies. To select the proxy type, use the ProxyType property.
Example
const string SenderCompId = "SenderCompID";
const string TargetCompId = "TargetCompID";
const ProtocolVersion Version = ProtocolVersion.Fix44;
var sessionSettings = new SessionSettings();
sessionSettings.Proxy.ProxyType = ProxyType.HTTP;
sessionSettings.Proxy.Host = "192.22.33.1";
sessionSettings.Proxy.Port = 5000;
// If the username and password are required:
sessionSettings.Proxy.Username = "Username";
const string ProxyPassword = "Password";
Array.ForEach(ProxyPassword.ToCharArray(), sessionSettings.Proxy.Password.AppendChar);
using Session initiator = new Session(TargetCompId, SenderCompId, Version, sessionSettings);
const string CounterpartyHost = "192.55.66.1";
const int CounterpartyPort = 6000;
// Establishes the proxy tunnel and then performs the usual Logon message exchange.
initiator.LogonAsInitiator(CounterpartyHost, CounterpartyPort);
// Message exchange and processing logic.
initiator.Logout();