예제 #1
0
        /// <summary>
        /// Creates a new ClientReConnecter object.
        /// It is not needed to start ClientReConnecter since it automatically
        /// starts when the client disconnected.
        /// </summary>
        /// <param name="client">Reference to client object</param>
        /// <exception cref="ArgumentNullException">Throws ArgumentNullException if client is null.</exception>
        public ClientReConnecter(IConnectableClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            _client = client;
            _client.Disconnected += Client_Disconnected;
            _reconnectTimer = new Timer(20000);
            _reconnectTimer.Elapsed += ReconnectTimer_Elapsed;
            _reconnectTimer.Start();
        }
예제 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 protected ScsClientBase()
 {
     _pingTimer = new Timer(30000);
     _pingTimer.Elapsed += PingTimer_Elapsed;
     ConnectTimeout = DefaultConnectionAttemptTimeout;
     WireProtocol = WireProtocolManager.GetDefaultWireProtocol();
 }