// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); //services.AddControllersWithViews(); services.AddMemoryCache((m) => { }); services.Configure <IISServerOptions>(options => { options.AutomaticAuthentication = false; }); services.AddWebSockets((options) => { }); var configurationBL = new ConfigurationBL(Configuration); GlobalSettings.WebSocketPort = configurationBL.WebSocketPort; GlobalSettings.SemaphoreInitial = configurationBL.SemaphoreInitial; GlobalSettings.DefaultCacheExpirationSeconds = configurationBL.DefaultCacheExpirationSeconds; GlobalSettings.AutoPopulateEndpoints = configurationBL.AutoPopulateEndpoints; GlobalSettings.PersistCacheToFile = configurationBL.PersistCacheToFile; GlobalSettings.PersistentDataFileName = configurationBL.PersistentDataFileName; var t = new System.Threading.Thread(() => { SynchronousSocketListener.StartListening(); }) { IsBackground = true }; t.Start(); //services.AddMvc(option => // { // option.OutputFormatters.Clear(); // option.OutputFormatters.Add(new Utf8JsonOutputFormatter(StandardResolver.Default)); // option.InputFormatters.Clear(); // option.InputFormatters.Add(new Utf8JsonInputFormatter()); // }); }
public static void Start(int port) { try { SynchronousSocketListener listener = new SynchronousSocketListener { HandleRequest = Listener.HandleRequest }; listener.StartListening(port); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); return; } }
public static void Start() { ManualResetEvent exchangeOpen = new ManualResetEvent(false); ManualResetEvent processSignaller = new ManualResetEvent(false); BizDomain equityDomain; equityDomain = new BizDomain("Salt Futures", new string[] { "RSXH", "RSXM", "RSXU", "RSXZ" }); equityDomain.OrderBook.OrderPriority = new PriceTimePriority(); EquityMatchingLogic equityMatchingLogic = new EquityMatchingLogic(equityDomain); equityDomain.Start(); //starts listening for orders Task.Factory.StartNew(() => SynchronousSocketListener.StartListening(equityDomain)); while (true) { if (DateTime.Now > startTime + stagingTime) { //equityDomain.findOpenPrice(); open = true; break; } else { exchangeOpen.WaitOne(10); } } Console.WriteLine("Press any key to stop"); Console.ReadLine(); return; }
//Mutex syncExchange = new Mutex(false, "SyncExchange"); //[STAThread] public static void Start() { LeafContainer.openPriceFound.Set(); EquityMatchingEngine.OMEHost.open = false; EquityMatchingEngine.OMEHost.running = true; EquityMatchingEngine.OMEHost.startTime = DateTime.Now; ManualResetEvent exchangeOpen = new ManualResetEvent(false); ManualResetEvent processSignaller = new ManualResetEvent(false); BizDomain equityDomain; equityDomain = new BizDomain("Salt Futures", new string[] { "RSXH", "RSXM", "RSXU", "RSXZ" }); equityDomain.OrderBook.OrderPriority = new PriceTimePriority(); EquityMatchingLogic equityMatchingLogic = new EquityMatchingLogic(equityDomain); equityDomain.Start(); //starts listening for orders Task.Factory.StartNew(() => SynchronousSocketListener.StartListening(equityDomain)); while (true) { if (DateTime.Now > startTime + stagingTime) { //equityDomain.findOpenPrice(); open = true; break; } else { exchangeOpen.WaitOne(10); } } }
public static int Main(String[] args) { SynchronousSocketListener.StartListening(); //SynchronousSocketClient.StartClient(); return(0); }
static int Main(string[] args) { Console.WriteLine("I am the Server."); SynchronousSocketListener.StartListening(); return(0); }
protected void StartServer_Click(object sender, EventArgs e) { SynchronousSocketListener ssl = new SynchronousSocketListener(); ssl.StartListening(); }
static void Main(string[] args) { SynchronousSocketListener.StartListening(); }
static int Main(string[] args) { SynchronousSocketListener.StartListening(); return(0); }
private void MainForm_Load(object sender, EventArgs e) { webBrowser1.Width = this.Width - 17; webBrowser1.Height = this.Height - 100; textBox1.Width = this.Width - 100; btn_go.Location = new Point(this.Width - btn_go.Width - 25, btn_go.Location.Y); webBrowser1.ScriptErrorsSuppressed = true; BackgroundWorker bw = new BackgroundWorker(); // this allows our worker to report progress during work // bw.WorkerReportsProgress = true; // what to do in the background thread bw.DoWork += new DoWorkEventHandler( delegate(object o, DoWorkEventArgs args) { while (true) { //BackgroundWorker b = o as BackgroundWorker; SynchronousSocketListener.StartListening(); string returned = SynchronousSocketListener.data; switch (returned.Substring(0, 2)) { case "up": //case "u-": System.Windows.Forms.SendKeys.SendWait("{PGUP}"); break; case "do": //case "d-": System.Windows.Forms.SendKeys.SendWait("{PGDN}"); break; case "ri": webBrowser1.GoForward(); //MessageBox.Show("forward"); break; case "le": webBrowser1.GoBack(); //MessageBox.Show("back"); break; case "se": string filter = returned.Substring(3); filter = filter.Replace(' ', '+'); webBrowser1.Navigate("https://www.google.com.eg/search?q=" + filter); textBox1.Text = "https://www.google.com.eg/search?q=" + filter; break; case "ma": webBrowser1.Navigate("file:///C:/Users/el-mostafa.org/Desktop/QingLong/InteractBrowser/InteractBrowser/maps2.html"); textBox1.Text = "file:///C:/Users/el-mostafa.org/Desktop/QingLong/InteractBrowser/InteractBrowser/maps2.html"; break; case "ft": webBrowser1.Navigate("file:///C:/Users/el-mostafa.org/Desktop/QingLong/InteractBrowser/InteractBrowser/maps2.html?r=" + returned.Substring(3)); textBox1.Text = "file:///C:/Users/el-mostafa.org/Desktop/QingLong/InteractBrowser/InteractBrowser/maps2.html?r=" + returned.Substring(3); break; } } }); bw.RunWorkerAsync(); webBrowser1.Navigate("http://www.google.com"); textBox1.Text = "http://www.google.com"; }