public ServerSession(IApplication application, string configFile) { _application = application; var CurrentSessionSettings = new SessionSettings(configFile); MessageStoreFactory storeFactory = new FileStoreFactory(CurrentSessionSettings); LogFactory logFactory = new FileLogFactory(CurrentSessionSettings); this.Acceptor = new ThreadedSocketAcceptor(_application, storeFactory, CurrentSessionSettings, logFactory); _sessionId = CurrentSessionSettings.GetSessions().FirstOrDefault(); SessionState = SessionState.Idle; _application.MessageEvent += (message) => { if (MessageEvent != null) { MessageEvent(message); } }; _application.LogonEvent += (s) => { _sessionId = s; SessionState |= SessionState.Connected; }; _application.LogoutEvent += (s) => { SessionState = SessionState.LoggedOut; }; }
static void Main(string[] args) { //SessionSettings settings = new SessionSettings("config.txt"); SessionSettings settings = new SessionSettings(); settings.Set(defaults); settings.Set(new SessionID("FIX.4.4", Guid.NewGuid().ToString(), "DERIBITSERVER"), new Dictionary("SESSION", new System.Collections.Generic.Dictionary <string, string>() { { "BeginString", "FIX.4.4" }, // {"SenderCompID",Guid.NewGuid().ToString() }, // {"ConnectionType","initiator" } })); // settings.Set(session); DerbitFixClient application = new DerbitFixClient(); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); // this is a developer-test kludge. do not emulate. application.MyInitiator = initiator; initiator.Start(); //application.QuerySecurityListRequest(); application.Run(); initiator.Stop(); }
void StartEngine(bool initiator) { TestApplication application = new TestApplication(LogonCallback, LogoffCallback); IMessageStoreFactory storeFactory = new MemoryStoreFactory(); SessionSettings settings = new SessionSettings(); Dictionary defaults = new Dictionary(); defaults.SetString(QuickFix.SessionSettings.FILE_LOG_PATH, _logPath); // Put IP endpoint settings into default section to verify that that defaults get merged into // session-specific settings not only for static sessions, but also for dynamic ones defaults.SetString(SessionSettings.SOCKET_CONNECT_HOST, Host); defaults.SetString(SessionSettings.SOCKET_CONNECT_PORT, ConnectPort.ToString()); defaults.SetString(SessionSettings.SOCKET_ACCEPT_HOST, Host); defaults.SetString(SessionSettings.SOCKET_ACCEPT_PORT, AcceptPort.ToString()); settings.Set(defaults); ILogFactory logFactory = new FileLogFactory(settings); if (initiator) { defaults.SetString(SessionSettings.RECONNECT_INTERVAL, "1"); settings.Set(CreateSessionID(StaticInitiatorCompID), CreateSessionConfig(StaticInitiatorCompID, true)); _initiator = new SocketInitiator(application, storeFactory, settings, logFactory); _initiator.Start(); } else { settings.Set(CreateSessionID(StaticAcceptorCompID), CreateSessionConfig(StaticAcceptorCompID, false)); _acceptor = new ThreadedSocketAcceptor(application, storeFactory, settings, logFactory); _acceptor.Start(); } }
public void Iniciar() { SessionSettings settings = new SessionSettings(this.ArquivoConfiguracao); FileStoreFactory store = new FileStoreFactory(settings); FileLogFactory logs = new FileLogFactory(settings); MessageFactory msgs = new DefaultMessageFactory(); // Cria o socket if (this.EhInitiator) { _socketInitiator = new SocketInitiator( this.AplicacaoFix, store, settings, logs, msgs); _socketInitiator.start(); } else { _socketAcceptor = new SocketAcceptor( this.AplicacaoFix, store, settings, logs, msgs); _socketAcceptor.start(); } // Envia mensagem para aplicação this.AplicacaoFix.Iniciar(); }
static void Main(string[] args) { var configBroker = AppDomain.CurrentDomain.BaseDirectory + "\\sample_acceptor.cfg"; SessionSettings settings = new SessionSettings(configBroker); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); var broker = new TradeAcceptor(); ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor( broker, storeFactory, settings, logFactory); string HttpServerPrefix = "http://127.0.0.1:5080/"; HttpServer srv = new HttpServer(HttpServerPrefix, settings); acceptor.Start(); srv.Start(); Console.WriteLine("View Executor status: " + HttpServerPrefix); Run(); srv.Stop(); acceptor.Stop(); }
static void Main(string[] args) { try { Console.WriteLine("Iniciando....."); SessionSettings settings = new SessionSettings("../../../executor.cfg"); IApplication myApp = new MyQuickFixApp(); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor( myApp, storeFactory, settings, logFactory); HttpServer srv = new HttpServer(HttpServerPrefix, settings); //Iniciando acceptor acceptor.Start(); //Iniciando servidor http srv.Start(); Console.WriteLine("Rodando em: " + HttpServerPrefix); Console.WriteLine("Aperte enter para finalizar"); Console.ReadLine(); //Finalizando acceptor e servidor http srv.Stop(); acceptor.Stop(); } catch (System.Exception e) { Console.WriteLine("Error"); Console.WriteLine(e.ToString()); } }
static void Main(string[] args) { Console.WriteLine("============="); Console.WriteLine("This is only an example program, meant to be used with the TradeClient example."); Console.WriteLine("============="); if (args.Length != 1) { Console.WriteLine("usage: Executor CONFIG_FILENAME"); System.Environment.Exit(2); } try { SessionSettings settings = new SessionSettings(args[0]); IApplication executorApp = new Executor(); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory); acceptor.Start(); Console.WriteLine("press <enter> to quit"); Console.Read(); acceptor.Stop(); } catch (System.Exception e) { Console.WriteLine("==FATAL ERROR=="); Console.WriteLine(e.ToString()); } }
static void Main(string[] args) { if (args.Length != 1) { System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME"); System.Environment.Exit(2); } FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug")); try { SessionSettings settings = new SessionSettings(args[0]); Application testApp = new ATApplication(debugLog); MessageStoreFactory storeFactory = new FileStoreFactory(settings); LogFactory logFactory = null; if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose")) { logFactory = new FileLogFactory(settings); //ScreenLogFactory(true, true, true); } ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory); acceptor.Start(); while (true) { System.Console.WriteLine("o hai"); System.Threading.Thread.Sleep(1000); } //acceptor.Stop(); } catch (System.Exception e) { debugLog.OnEvent(e.ToString()); } }
static void Main(string[] args) { if (args.Length != 1) { System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME"); System.Environment.Exit(2); } FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug")); ThreadedSocketAcceptor acceptor = null; try { ATApplication testApp = new ATApplication(debugLog); testApp.StopMeEvent += new System.Action(delegate() { _stopMe = true; }); SessionSettings settings = new SessionSettings(args[0]); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = null; if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose")) { logFactory = new FileLogFactory(settings); } acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory); acceptor.Start(); while (true) { System.Console.WriteLine("o hai " + System.DateTime.Now.ToString()); System.Threading.Thread.Sleep(1000); // for tests of logout if (_stopMe) { // this doesn't seem to work // after stop, it doesn't seem to start up again /* * acceptor.Stop(); * Thread.Sleep(5 * 1000); * _stopMe = false; * acceptor.Start(); */ } } } catch (System.Exception e) { debugLog.OnEvent(e.ToString(), Severity.Error, e); } finally { if (acceptor != null) { acceptor.Stop(); } } }
private ThreadedSocketAcceptor createAppFrom(string configFileName) { var app = new InitiatorApp(); var settings = new SessionSettings(configFileName); var storeFactory = new FileStoreFactory(settings); var logFactory = new FileLogFactory(settings); return(new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory)); }
public void Init(string path) { sessionSettings = new SessionSettings(path); IApplication fixapp = new FixApp(); IMessageStoreFactory storeFactory = new FileStoreFactory(sessionSettings); FileLogFactory logFactory = new FileLogFactory(sessionSettings); initiator = new SocketInitiator(fixapp, storeFactory, sessionSettings, logFactory); }
public static void Main2(string[] args) { BTCCFIXClientApp app = new BTCCFIXClientApp(); string sessionFile = Environment.CurrentDirectory + "/session_client.txt"; SessionSettings settings = new SessionSettings(sessionFile); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(app, storeFactory, settings, logFactory); initiator.Start(); BTCCMarketDataRequest btccDataRequest = new BTCCMarketDataRequest(); System.Threading.Thread.Sleep(5000); //request full snapshot MarketDataRequest dataRequest = btccDataRequest.marketDataFullSnapRequest("BTCCNY"); bool ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataFullSnapRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(15000); //request incremental request dataRequest = btccDataRequest.marketDataIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.marketDataIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); System.Threading.Thread.Sleep(40000); //unsubscribe incremental request dataRequest = btccDataRequest.unsubscribeIncrementalRequest("BTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCCNY"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); dataRequest = btccDataRequest.unsubscribeIncrementalRequest("LTCBTC"); ret = Session.SendToTarget(dataRequest, app.m_sessionID); Console.WriteLine("SendToTarget ret={0}", ret); }
public void initFix() { settings = new QuickFix.SessionSettings(@"c:\s2trading\zmqhubresource\tradeclient.cfg"); myApp = new FixClient(); FileStoreFactory storeFactory = new FileStoreFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); initiator = new QuickFix.Transport.SocketInitiator(myApp, storeFactory, settings, logFactory); initiator.Start(); }
public void Start() { SessionSettings settings = new SessionSettings(ConfigFileName); FileStoreFactory storeFactory = new FileStoreFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); MessageFactory messageFactory = new DefaultMessageFactory(); this.initiator = new SocketInitiator(this, storeFactory, settings, logFactory /*optional*/, messageFactory); this.initiator.start(); }
public void Start(IFIXServices fixServices) { this.fixServices = fixServices; this.settings = new SessionSettings(settingsPath); this.storeFactory = new FileStoreFactory(this.settings); this.logFactory = new FileLogFactory(this.settings); this.messageFactory = new DefaultMessageFactory(); this.initiator = new SocketInitiator(this, this.storeFactory, this.settings, this.messageFactory); this.initiator.start(); }
public Form1() { InitializeComponent(); conn = new Connection(); SessionSettings settings = new SessionSettings("session_client.txt"); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); initiator = new QuickFix.Transport.SocketInitiator(conn, storeFactory, settings, logFactory); }
static void Main(string[] args) { SessionSettings settings = new SessionSettings("ini.cfg"); IApplication fixHub = new FixHub(); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(fixHub, storeFactory, settings, logFactory); acceptor.Start(); Console.ReadKey(); acceptor.Stop(); }
static void Main(string[] args) { SessionID _DummySessionID = new SessionID("a", "b", "c"); IMessageFactory _defaultMsgFactory = new DefaultMessageFactory(); //string data = "8=FIXT.1.1"+Message.SOH+"9=735"+Message.SOH+"35=AE"+Message.SOH+"34=494"+Message.SOH+"1128=8"+Message.SOH+"49=RTNSFIXUAT"+Message.SOH+"56=YEPIRECUAT"+Message.SOH+"52=20151027-11:59:15"+Message.SOH+"552=1"+Message.SOH+"54=1"+Message.SOH+"37=Z0009WSGC4"+Message.SOH+"11=NOREF"+Message.SOH+"826=0"+Message.SOH+"78=1"+Message.SOH+"79=NOT SPECIFIED"+Message.SOH+"80=120.000000"+Message.SOH+"5967=91.070000"+Message.SOH+"5966=120.000000"+Message.SOH+"5968=91.040000"+Message.SOH+"453=5"+Message.SOH+"448=YPKB"+Message.SOH+"452=3"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=YPKB"+Message.SOH+"803=5"+Message.SOH+"448=BARX"+Message.SOH+"452=1"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=BARX"+Message.SOH+"803=5"+Message.SOH+"448=BARX"+Message.SOH+"452=16"+Message.SOH+"447=D"+Message.SOH+"802=1"+Message.SOH+"523=BARX"+Message.SOH+"803=5"+Message.SOH+"448=bcart7"+Message.SOH+"452=11"+Message.SOH+"447=D"+Message.SOH+"448=Barclays Capital"+Message.SOH+"452=12"+Message.SOH+"447=D"+Message.SOH+"571=10106232"+Message.SOH+"150=F"+Message.SOH+"17=Z0009WSGC4"+Message.SOH+"32=120.000000"+Message.SOH+"38=120.000000"+Message.SOH+"15=CAD"+Message.SOH+"31=1.317700"+Message.SOH+"555=2"+Message.SOH+"624=1"+Message.SOH+"637=1.317700"+Message.SOH+"1418=120.000000"+Message.SOH+"588=20151028"+Message.SOH+"587=0"+Message.SOH+"1073=0.0000"+Message.SOH+"1074=91.070000"+Message.SOH+"5190=1.317700"+Message.SOH+"624=2"+Message.SOH+"637=1.318062"+Message.SOH+"1418=120.000000"+Message.SOH+"588=20151130"+Message.SOH+"587=M1"+Message.SOH+"1073=3.6200"+Message.SOH+"1074=91.040000"+Message.SOH+"5190=1.317700"+Message.SOH+"60=20151027-11:59:14"+Message.SOH+"75=20151027"+Message.SOH+"1057=Y"+Message.SOH+"39=2"+Message.SOH+"460=4"+Message.SOH+"167=FOR"+Message.SOH+"65=SW"+Message.SOH+"55=USD/CAD"+Message.SOH+"10=076"+Message.SOH; //var msg = new QuickFix.FIX50.TradeCaptureReport(); //var dd = new QuickFix.DataDictionary.DataDictionary(); //dd.Load(@"C:\Code\tfs\neerajkaushik\MarketConnect Gateway\Source\Source\QuickFix1.5\quickfixn-master\quickfixn-master\spec\fix\reuters.fix50sp1.xml"); //msg.FromString(data, false, dd, dd, _defaultMsgFactory); //MessageCracker mc = new TestCracker(); //mc.Crack(msg, _DummySessionID); //var grp = msg.GetGroup(1, Tags.NoLegs); Console.WriteLine("============="); Console.WriteLine("This is only an example program."); Console.WriteLine("It's a simple server (e.g. Acceptor) app that will let clients (e.g. Initiators)"); Console.WriteLine("connect to it. It will accept and display any application-level messages that it receives."); Console.WriteLine("Connecting clients should set TargetCompID to 'SIMPLE' and SenderCompID to 'CLIENT1' or 'CLIENT2'."); Console.WriteLine("Port is 5001."); Console.WriteLine("(see simpleacc.cfg for configuration details)"); Console.WriteLine("============="); try { SessionSettings settings = new SessionSettings("acceptor.cfg"); Application executorApp = new Executor(); MessageStoreFactory storeFactory = new FileStoreFactory(settings); LogFactory logFactory = new FileLogFactory(settings); ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory); acceptor.Start(); Console.WriteLine("press <enter> to quit"); Console.Read(); acceptor.Stop(); } catch (System.Exception e) { Console.WriteLine("==FATAL ERROR=="); Console.WriteLine(e.ToString()); Console.WriteLine("press <enter> to quit"); Console.Read(); } }
public static void Initialize(string settingsFilePath, Router router, FixSessionStatusChangedDelegate sessionStatus) { _FixSessionStatusChangedDelegate = sessionStatus; _router = router; SessionSettings settings = new SessionSettings(settingsFilePath); ClientApp application = new ClientApp(); FileStoreFactory storeFactory = new FileStoreFactory(settings); //logFactory = new ScreenLogFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); MessageFactory messageFactory = new DefaultMessageFactory(); _initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory); }
public static void Initialize(string settingsFilePath, IRouter router, FixSessionStatusChangedDelegate sessionStatus) { m_FixSessionStatusChangedDelegate = sessionStatus; m_filePath = settingsFilePath; settings = new SessionSettings(m_filePath); application = new Application(m_initiator, router, m_FixSessionStatusChangedDelegate); storeFactory = new FileStoreFactory(settings); //logFactory = new ScreenLogFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); messageFactory = new DefaultMessageFactory(); m_initiator = new SocketInitiator(application, storeFactory, settings, logFactory, messageFactory); //m_initiator = new SocketInitiator(application, storeFactory, settings, messageFactory); }
/// <summary> /// Connects/Starts a client /// </summary> public bool Start() { try { if (this._initiator == null) { PopulateFixSettings(); SessionSettings settings = new SessionSettings(this._fixSettingsFile); IApplication application = this; FileStoreFactory storeFactory = new FileStoreFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); IMessageStoreFactory messageFactory = new FileStoreFactory(settings); this._initiator = new SocketInitiator(application, storeFactory, settings, logFactory); this._initiator.Start(); if (Logger.IsInfoEnabled) { Logger.Info("Forexware Fix Order Client Started.", _type.FullName, "Start"); } } else { if (!this._initiator.IsStopped) { if (Logger.IsInfoEnabled) { Logger.Info("Forexware Fix Order Client Already Started.", _type.FullName, "Start"); } } else { this._initiator.Start(); if (Logger.IsInfoEnabled) { Logger.Info("Forexware Fix Order Client Started.", _type.FullName, "Start"); } } } return(true); } catch (Exception exception) { Logger.Error(exception.ToString(), _type.FullName, "Start"); } return(false); }
public OrderMatchingEngine( IApplication requestNetworkHandler, SessionSettings sessionSettings, FileStoreFactory fileStoreFactory, FileLogFactory fileLogFactory) { this.requestNetworkHandler = requestNetworkHandler; this.sessionSettings = sessionSettings; this.fileStoreFactory = fileStoreFactory; this.fileLogFactory = fileLogFactory; this.acceptor = new ThreadedSocketAcceptor(requestNetworkHandler, fileStoreFactory, sessionSettings, fileLogFactory); }
/// <summary> /// InitializSession /// </summary> public Task Initialize(Action <string> progress, CancellationToken cancellationToken) { return(Task.Run(() => { var settings = new SessionSettings("cts.cfg"); IMessageStoreFactory messageFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); initiator = new SocketInitiator(this, messageFactory, settings, logFactory); progress("Initialization done"); }, cancellationToken)); }
static void Main(string[] args) { SessionSettings settings = new SessionSettings("SessionConfig.cfg"); //load config file IApplication myApp = new MyFixApplication(); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); SocketInitiator fixClient = new SocketInitiator( myApp, storeFactory, settings, logFactory); fixClient.Start(); // start connecting to FIX Aceptor Console.ReadLine(); //press Enter to stop Fix Client fixClient.Stop(); }
public void initInitiator(string file) { SessionSettings settings = new SessionSettings(file); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); SocketInitiator initiator = new SocketInitiator( this, storeFactory, settings, logFactory ); initiator.Start(); Run(); initiator.Stop(); }
internal void setupFixConnection() { //SessionSettings settings = new SessionSettings("D:\\RealtimeSpread\\RealtimeSpreadMonitor\\StageOrdersFIXConfigFiles\\stageorders.cfg"); string dir = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "StageOrdersFIXConfigFiles\\stageorders.cfg"); SessionSettings settings = new SessionSettings(dir); _fixConnectionSystem = new FixConnectionSystem(settings); IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); //QuickFix.SocketInitiatorThread acceptor = new SocketInitiatorThread( initiator = new QuickFix.Transport.SocketInitiator( _fixConnectionSystem, storeFactory, settings, logFactory); _fixConnectionSystem.Initiator = initiator; _fixConnectionSystem.dataRequestMessageReturned += new Action <QuickFix.FIX42.MarketDataSnapshotFullRefresh>(marketDataReturned); //QuickFix.SocketInitiatorThread initiatorThread = new QuickFix.SocketInitiatorThread( // initiator, // storeFactory, // settings, // logFactory); //initiator. //myApp. //while (true) //{ // System.Console.WriteLine("o hai"); // System.Threading.Thread.Sleep(1000); //} //initiator.Stop(); //_fixConnectionSystem.LogonEvent += new Action(delegate() { _fixConnectionSystem.IsConnected = true; }); //_fixConnectionSystem.LogoutEvent += new Action(delegate() { _fixConnectionSystem.IsConnected = false; }); }
static void Main(string[] args) { var settingsFile = "FixAtServer.cfg"; if (args.Length >= 1) { settingsFile = args[0]; } Console.WriteLine("Starting server ..."); try { var settings = new SessionSettings(settingsFile); var server = new ServerApplication(Console.WriteLine); var storeFactory = new FileStoreFactory(settings); var logFactory = new FileLogFactory(settings); var acceptor = new ThreadedSocketAcceptor(server, storeFactory, settings, logFactory); acceptor.Start(); Console.WriteLine("Server started"); Console.WriteLine("Press Ctrl-C to quit"); // TODO A better stop mechanism! // http://stackoverflow.com/questions/177856/how-do-i-trap-ctrl-c-in-a-c-sharp-console-app Console.CancelKeyPress += (sender, e) => { Console.WriteLine("Stopping server ..."); acceptor.Stop(); server.Stop(); Console.WriteLine("Server stopped"); }; while (true) { System.Threading.Thread.Sleep(1000); } } catch (Exception e) { Console.WriteLine("Error: {0}", e); } }
public FixDataAccess(ISqlDataAccess sql) { _sql = sql; string file = AppDomain.CurrentDomain.BaseDirectory + @"\Internal\FixAccess\tradeclient.cfg"; SessionSettings settings = new SessionSettings(file); fixApp = new QuickFixApp(); fixApp.FillReceived += FixApp_FillReceived; IMessageStoreFactory storeFactory = new FileStoreFactory(settings); ILogFactory logFactory = new FileLogFactory(settings); SocketInitiator initiator = new SocketInitiator( fixApp, storeFactory, settings, logFactory); initiator.Start(); }
static void OpenFixConn() { try { string fixClientConf = Environment.CurrentDirectory + @"\" + SystemConfigurations.GetAppSetting("FixClientConfPath"); SessionSettings settings = new SessionSettings(fixClientConf); OnConnectionChanged d = new OnConnectionChanged(FixConnChanged); _app = new ClientApp(d); //_app.OnStatusChanged+= FileStoreFactory storeFactory = new FileStoreFactory(settings); FileLogFactory logFactory = new FileLogFactory(settings); MessageFactory messageFactory = new DefaultMessageFactory(); _initiator = new SocketInitiator(_app, storeFactory, settings, logFactory, messageFactory); _initiator.start(); } catch (Exception ex) { Console.WriteLine(ex); } }
static void Main(string[] args) { try { QuickFix.SessionSettings settings = new QuickFix.SessionSettings("config_nossl.cfg"); MarketDataApp application = new MarketDataApp(); QuickFix.IMessageStoreFactory storeFactory = new QuickFix.FileStoreFactory(settings); QuickFix.ILogFactory logFactory = new FileLogFactory(settings); QuickFix.Transport.SocketInitiator initiator = new QuickFix.Transport.SocketInitiator(application, storeFactory, settings, logFactory); initiator.Start(); System.Threading.Thread.Sleep(Int32.MaxValue); } catch (System.Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.ReadLine(); } Environment.Exit(1); }