コード例 #1
0
 protected internal ProxyConnectionHandler(string host, int port)
 {
     this.host          = host;
     this.port          = port;
     reconnectingSocket = null;
     failures           = 0;
 }
コード例 #2
0
 public void Close()
 {
     if (reconnectingSocket != null)
     {
         reconnectingSocket.Close();
         reconnectingSocket = null;
     }
 }
コード例 #3
0
 public void Close()
 {
     if (IsConnected())
     {
         reconnectingSocket.Close();
         reconnectingSocket = null;
     }
 }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        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");
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 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);
     }
 }
コード例 #8
0
        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);
            }

        }