private static void AddConnectionProperties(IDictionary parameters, ConnectionInfo properties) { if (properties.contentLength > 0) { parameters["LS_content_length"] = Convert.ToString(properties.contentLength); } if (properties.keepaliveMillis > 0L) { parameters["LS_keepalive_millis"] = Convert.ToString(properties.keepaliveMillis); } if (properties.isPolling) { parameters["LS_polling"] = "true"; if (properties.pollingMillis > 0L) { parameters["LS_polling_millis"] = Convert.ToString(properties.pollingMillis); } else { parameters["LS_polling_millis"] = "0"; } if (properties.pollingIdleMillis > 0L) { parameters["LS_idle_millis"] = Convert.ToString(properties.pollingIdleMillis); } } parameters["LS_report_info"] = "true"; }
internal PushServerTranslator(ConnectionInfo info) { int realLen; this.cookies = new CookieContainer(); this.batchManager = new BatchManager(this.cookies); this.mexBatchManager = new BatchManager(this.cookies); ConnectionInfo localInfo = (ConnectionInfo) info.Clone(); if (localInfo.PushServerUrl == null) { throw new PushConnException("Connection property 'pushServerUrl' not set"); } while (localInfo.PushServerUrl.EndsWith("/")) { realLen = localInfo.PushServerUrl.Length - 1; localInfo.PushServerUrl = localInfo.PushServerUrl.Substring(0, realLen); } if (localInfo.PushServerControlUrl != null) { while (localInfo.PushServerControlUrl.EndsWith("/")) { realLen = localInfo.PushServerControlUrl.Length - 1; localInfo.PushServerControlUrl = localInfo.PushServerControlUrl.Substring(0, realLen); } } this.info = localInfo; }
internal ServerManager(ConnectionInfo info, IServerListener asyncListener) { this.connInfo = info; this.localPushServerProxy = new PushServerProxy(info); this.activityController = new ActivityController(this); this.serverListener = asyncListener; }
internal ServerManager(ConnectionInfo info, IConnectionListener listener, IServerListener asyncListener) { Stream stream = null; this.probeTimeoutMillis = info.probeTimeoutMillis; this.probeWarningMillis = info.probeWarningMillis; this.reconnectionTimeoutMillis = info.reconnectionTimeoutMillis; this.localPushServerProxy = new PushServerProxy(info); try { stream = this.localPushServerProxy.ConnectForSession(); try { listener.OnConnectionEstablished(); } catch (Exception) { } this.localPushServerProxy.StartSession(stream); try { listener.OnSessionStarted(); } catch (Exception) { } } catch (PhaseException) { } this.serverListener = asyncListener; }
internal ServerManager(ConnectionInfo info, IServerListener asyncListener) { this.connInfo = info; this.localPushServerProxy = new PushServerProxy(info); this.activityController = new ActivityController(this); this.mexParallelizer = new MessageParallelizer(this.mexBatchMonitor, this); this.serverListener = asyncListener; }
public void Start(string pushServerUrl, int phase, ILightstreamerListener listener) { StocklistConnectionListener ls = new StocklistConnectionListener(listener, phase); ConnectionInfo connInfo = new ConnectionInfo(); connInfo.PushServerUrl = pushServerUrl; connInfo.Adapter = "DEMO"; client.OpenConnection(connInfo, ls); }
public Page(string LSHost) { InitializeComponent(); connInfo = new ConnectionInfo(); connInfo.PushServerUrl = LSHost; connInfo.Adapter = "DEMO"; syncContext = SynchronizationContext.Current; this.Start(); }
public void Start(string pushServerUrl, int phase, ILightstreamerListener listener) { StocklistConnectionListener ls = new StocklistConnectionListener(listener, phase); ConnectionInfo connInfo = new ConnectionInfo(); connInfo.PushServerUrl = pushServerUrl; connInfo.Adapter = "CITYINDEXSTREAMING"; connInfo.User = Username; connInfo.Password = SessionId; connInfo.Constraints.MaxBandwidth = 999999; client.OpenConnection(connInfo, ls); }
private static void AddConnectionPropertiesForFakePolling(IDictionary parameters, ConnectionInfo properties) { if (properties.ContentLength > 0L) { parameters["LS_content_length"] = Convert.ToString(properties.ContentLength); } if (properties.KeepaliveMillis > 0L) { parameters["LS_keepalive_millis"] = Convert.ToString(properties.KeepaliveMillis); } parameters["LS_polling"] = "true"; parameters["LS_polling_millis"] = "0"; parameters["LS_idle_millis"] = "0"; parameters["LS_report_info"] = "true"; }
public StocklistClient( string pushServerUrl, DemoForm form, LightstreamerUpdateDelegate lsUpdateDelegate, LightstreamerStatusChangedDelegate lsStatusChangeDelegate) { demoForm = form; updateDelegate = lsUpdateDelegate; statusChangeDelegate = lsStatusChangeDelegate; cInfo = new ConnectionInfo(); cInfo.PushServerUrl = pushServerUrl; cInfo.Adapter = "DEMO"; client = new LSClient(); }
internal PushServerTranslator(ConnectionInfo info) { int num; this.batchManager = new BatchManager(); ConnectionInfo info2 = (ConnectionInfo) info.Clone(); if (info2.pushServerUrl == null) { throw new PushConnException("Connection property 'pushServerUrl' not set"); } while (info2.pushServerUrl.EndsWith("/")) { num = info2.pushServerUrl.Length - 1; info2.pushServerUrl = info2.pushServerUrl.Substring(0, num); } if (info2.pushServerControlUrl != null) { while (info2.pushServerControlUrl.EndsWith("/")) { num = info2.pushServerControlUrl.Length - 1; info2.pushServerControlUrl = info2.pushServerControlUrl.Substring(0, num); } } this.info = info2; }
public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener) { int currPhase; object CS$2$0000; lock ((CS$2$0000 = this.stateMutex)) { this.CloseConnection(); currPhase = ++this.phase; } ConnectionInfo myInfo = (ConnectionInfo) info.Clone(); if (myInfo.EnableStreamSense && !myInfo.Polling) { LSClient testClient = new LSClient(); ExtConnectionListener myListener = new ExtConnectionListener(listener); ConnectionInfo mySubInfo = (ConnectionInfo) info.Clone(); mySubInfo.EnableStreamSense = false; new Thread(delegate { try { testClient.OpenConnection(mySubInfo, myListener); } catch (Exception) { } }) { IsBackground = true }.Start(); if (!myListener.WaitStreamingTimeoutAnswer()) { lock ((CS$2$0000 = this.stateMutex)) { if (currPhase == this.phase) { this.subClient = testClient; } else { AsynchCloseConnection(testClient); return; } } myListener.FlushAndStart(); } else { AsynchCloseConnection(testClient); lock ((CS$2$0000 = this.stateMutex)) { if (currPhase != this.phase) { return; } } LSClient pollClient = new LSClient(); myInfo.Polling = true; pollClient.OpenConnection(myInfo, listener); lock ((CS$2$0000 = this.stateMutex)) { if (currPhase == this.phase) { this.subClient = pollClient; } else { AsynchCloseConnection(pollClient); } } } } else { MyServerListener serverListener = new MyServerListener(this, listener, currPhase); bool ok = false; try { ServerManager newManager = new ServerManager(myInfo, serverListener); newManager.Connect(); ok = true; lock ((CS$2$0000 = this.stateMutex)) { if (currPhase == this.phase) { this.connListener = listener; this.asyncListener = serverListener; this.connManager = newManager; } else { CloseFlushing(newManager, serverListener, listener); return; } } newManager.Start(); } finally { if (!ok) { serverListener.OnClosed(null); } } } }
internal PushServerProxy(ConnectionInfo info) { this.serverTranslator = new PushServerTranslator(info); }
public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener) { ConnectionInfo info2 = (ConnectionInfo) info.Clone(); info2.useGetForStreaming = true; lock (this.connMutex) { object obj3; this.CloseConnection(); if (info2.enableStreamSense && !info2.isPolling) { ThreadStart start = null; LSClient testClient = new LSClient(); ExtConnectionListener myListener = new ExtConnectionListener(listener); ConnectionInfo mySubInfo = (ConnectionInfo) info.Clone(); mySubInfo.enableStreamSense = false; new Thread(() => { try { testClient.OpenConnection(mySubInfo, myListener); } catch (Exception) { } }).Start(); if (!myListener.WaitStreamingTimeoutAnswer()) { lock ((obj3 = this.stateMutex)) { this.subClient = testClient; } myListener.FlushAndStart(); } else { if (start == null) { start = delegate { testClient.CloseConnection(); }; } new Thread(start).Start(); LSClient client = new LSClient(); info2.isPolling = true; client.OpenConnection(info2, listener); lock ((obj3 = this.stateMutex)) { this.subClient = client; } } } else { int num; lock ((obj3 = this.stateMutex)) { num = this.phase + 1; } MyServerListener asyncListener = new MyServerListener(this, listener, num); bool flag2 = false; try { ServerManager manager = new ServerManager(info2, asyncListener); manager.Connect(); lock ((obj3 = this.stateMutex)) { this.connListener = listener; this.asyncListener = asyncListener; this.phase = num; this.connManager = manager; } flag2 = true; manager.Start(); } finally { if (!flag2) { asyncListener.OnClosed(null); } } } } }
public bool Connect(string username, string cstToken, string xSecurityToken, string apiKey, string lsHost) { bool connectionEstablished = false; ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.Adapter = "DEFAULT"; connectionInfo.User = username; connectionInfo.Password = "******" + cstToken + "|XST-" + xSecurityToken; connectionInfo.PushServerUrl = lsHost; try { if (lsClient != null) { lsClient.OpenConnection(connectionInfo, this); connectionEstablished = true; } } catch (Exception) { connectionEstablished = false; } return connectionEstablished; }
public virtual void OpenConnection(ConnectionInfo info, IConnectionListener listener) { lock (this.connMutex) { int num; object obj3; this.CloseConnection(); lock ((obj3 = this.stateMutex)) { num = this.phase + 1; } ServerManager.IServerListener asyncListener = new MyServerListener(this, num); ServerManager manager = new ServerManager(info, listener, asyncListener); lock ((obj3 = this.stateMutex)) { this.connListener = listener; this.phase = num; this.connManager = manager; } manager.Start(); } }