コード例 #1
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            var msgFactory = new OpenApiMessagesFactory();
            var msg        = msgFactory.CreateHeartbeatEvent();

            Transmit(msg, false);
        }
コード例 #2
0
        static void SendHeartbeatEvent(OpenApiMessagesFactory msgFactory, Queue writeQueue)
        {
            var _msg = msgFactory.CreateHeartbeatEvent();

            if (isDebugIsOn)
            {
                Console.WriteLine("SendHeartbeatEvent() Message to be send:\n{0}", OpenApiMessagesPresentation.ToString(_msg));
            }
            writeQueue.Enqueue(Utils.Serialize(_msg));
        }
コード例 #3
0
        void SendHeartbeatEvent(OpenApiMessagesFactory msgFactory, Queue writeQueue)
        {
            var _msg = msgFactory.CreateHeartbeatEvent();

#if TRACE_HEARTBEAT
            if (isDebugIsOn)
            {
                Console.WriteLine("SendHeartbeatEvent() Message to be sent:\n{0}", OpenApiMessagesPresentation.ToString(_msg));
            }
#endif
            writeQueue.Enqueue(_msg.ToByteArray());
        }
コード例 #4
0
        private void HeartBeat(object obj, System.Timers.ElapsedEventArgs e)
        {
            //keep connection alive with a heartbeat atleast every 10 seconds
            var msgFactory = new OpenApiMessagesFactory();
            var msg        = msgFactory.CreateHeartbeatEvent();

            _trasmitQueue.Enqueue(msg);


            //stop the timer if the connection has died
            if (isShutdown)
            {
                _heartbeatTimer.Stop();
            }
        }