protected internal ProxyConnectionHandler(string host, int port) { this.host = host; this.port = port; reconnectingSocket = null; failures = 0; }
public void Close() { if (reconnectingSocket != null) { reconnectingSocket.Close(); reconnectingSocket = null; } }
public void Close() { if (IsConnected()) { reconnectingSocket.Close(); reconnectingSocket = null; } }
/// <summary> /// /// </summary> /// <param name="ipaddress"></param> /// <param name="ipport"></param> /// <param name="usePrefix"></param> public ReconSocketClient(string ipaddress, int ipport, bool usePrefix = false) { //int port = AppConfigReader.GetIntKeyValue("Port"); //string IPAddress = AppConfigReader.GetStringKeyValue("IPAddress"); // RecSocket used come additional message packing RecSocketClient = new ReconnectingSocket(); RecSocketClient.Verbose = true; RecSocketClient.InitClient(ipaddress, ipport, false); RecSocketClient.OnConnection += new ReconnectingSocket.OnConnectionEvent(OnSocketClientConnection); RecSocketClient.OnData += new ReconnectingSocket.OnDataEvent(OnSocketClientReceiveData); }
protected internal ProxyConnectionHandler(string host, int port, WavefrontSdkMetricsRegistry sdkMetricsRegistry, string entityPrefix, ILoggerFactory loggerFactory) { this.host = host; this.port = port; this.loggerFactory = loggerFactory; reconnectingSocket = null; this.sdkMetricsRegistry = sdkMetricsRegistry; this.entityPrefix = string.IsNullOrWhiteSpace(entityPrefix) ? "" : entityPrefix + "."; errors = this.sdkMetricsRegistry.Counter(this.entityPrefix + "errors"); connectErrors = this.sdkMetricsRegistry.Counter(this.entityPrefix + "connect.errors"); }
public void Connect() { if (reconnectingSocket != null) { throw new InvalidOperationException("Already connected"); } try { reconnectingSocket = new ReconnectingSocket(host, port); } catch (Exception e) { throw new IOException(e.Message, e); } }
public void Connect() { if (reconnectingSocket != null) { throw new InvalidOperationException("Already connected"); } try { reconnectingSocket = new ReconnectingSocket(host, port, sdkMetricsRegistry, entityPrefix + "socket", loggerFactory); } catch (Exception e) { connectErrors.Inc(); throw new IOException(e.Message, e); } }
public ReconSocketServer(int ipport) { //int port = AppConfigReader.GetIntKeyValue("Port"); //private string IPAddress = AppConfigReader.GetStringKeyValue("IPAddress"); try { RecSocketServer = new ReconnectingSocket(); RecSocketServer.Verbose = true; RecSocketServer.InitServer(ipport, false); RecSocketServer.OnConnection += new ReconnectingSocket.OnConnectionEvent(OnSocketServerConnection); RecSocketServer.OnData += new ReconnectingSocket.OnDataEvent(OnServerSocketData); Debug.WriteLine("TCP server is listening on port: " + ipport); } catch (System.Exception ex) { Debug.WriteLine("TCP server establish error: " + ex); } }