예제 #1
0
        private void OnTimerElapsed(object sender, ElapsedEventArgs e)
        {
            Tuple <CurrencyName, IPEndPoint> pair = null;

            lock (_obj)
            {
                if (_connections.Count == 0)
                {
                    return;
                }
                pair = _connections[_counter];
            }
            try
            {
                _tcp.InvokeServer(pair.Item2, new byte[] { (byte)pair.Item1 });
            }
            catch (SocketException sx)
            {
                _log.WriteError(String.Format("[{0}] {1}", sx.SocketErrorCode.ToString(), sx.Message));
            }
            if (++_counter == _connections.Count)
            {
                _counter = 0;
            }
        }