forwardMessage Throttling   Table of ContentFlatMessage Modeforward
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
C#
using FIXForge.NET.FIX;
using FIXForge.NET.FIX.FIX44;

const string senderCompID = "SenderCompID";
const string targetCompID = "TargetCompID";
const ProtocolVersion version = ProtocolVersion.FIX44;

// HTTP Proxy host.
const string ProxyHost = "192.22.33.1";
// HTTP Proxy port.
const int ProxyPort = 5000;
// HTTP Proxy user name if necessary.
const string ProxyUsername = "Username";
// HTTP Proxy password if necessary.
const string ProxyPassword = "Password";

// Counterparty host.
const string CounterpartyHost = "192.55.66.1";
// Counterparty port.
const int CounterpartyPort = 6000;

using (Session initiator =
    new Session(targetCompID, senderCompID, version))
{
    // Sets HTTP proxy settings, which will be used in the Session.LogonAsInitiator method
    // to setup the proxy connection before the Logon exchange.
    initiator.Proxy.Host = ProxyHost;
    initiator.Proxy.Port = ProxyPort;
    initiator.Proxy.Username = ProxyUsername;
    initiator.Proxy.Password = ProxyPassword;

    // Establishes the proxy tunnel first and then performs the usual Logon exchange.
    initiator.LogonAsInitiator(CounterpartyHost, CounterpartyPort);

    // Message exchange and processing logic goes here as usual.

    initiator.Logout();
}