Exemplo n.º 1
0
        } // TmonReceiver

        public void Init()
        {
            _tmonUmSource = _parentTmonContext.GetTmonUmSource();
            _timeOfDay    = new TmonGetTimeOfDay();

            _messageBuffer.Clear();
            if (_rcvType == ReceiverType.Regular)
            {
                _messageBuffer.Append('R');
            }
            else if (_rcvType == ReceiverType.Wildcard)
            {
                _messageBuffer.Append('W');
            }
            else
            {
                throw new TmonException("invalid rcvType " + (int)_rcvType);
            }
            _messageBuffer.Append(',');
            _messageBuffer.Append(_parentTmonContext.GetMessageHeader());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetSec());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetUsec());
            _messageBuffer.Append(','); _messageBuffer.Append(_objectId);
            _messageBuffer.Append(','); _messageBuffer.Append(_topicName);

            _tmonUmSource.send(Encoding.ASCII.GetBytes(_messageBuffer.ToString()), _messageBuffer.Length, 0);
        } // Init
Exemplo n.º 2
0
        } // TmonSource

        public void Init()
        {
            _tmonUmSource = _parentTmonContext.GetTmonUmSource();
            _timeOfDay    = new TmonGetTimeOfDay();

            _messageBuffer.Clear();
            _messageBuffer.Append('S'); _messageBuffer.Append(',');
            _messageBuffer.Append(_parentTmonContext.GetMessageHeader());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetSec());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetUsec());
            _messageBuffer.Append(','); _messageBuffer.Append(_objectId);
            _messageBuffer.Append(','); _messageBuffer.Append(_topicName);

            _tmonUmSource.send(Encoding.ASCII.GetBytes(_messageBuffer.ToString()), _messageBuffer.Length, 0);
        } // Init
Exemplo n.º 3
0
        } // close

        public void InitSender()
        {
            // Encode app ID.
            _appId = _appUmContext.getAttributeValue("monitor_appid")
                     .Replace("\\", "\\1")
                     .Replace(",", "\\2");
            _transportOptsStr = _appUmContext.getAttributeValue("monitor_transport_opts");
            _transportOpts    = _transportOptsStr.Split(';');
            // Encode context name.
            _appContextName = _appUmContext.getAttributeValue("context_name")
                              .Replace("\\", "\\1")
                              .Replace(",", "\\2");

            GetMonSettings(); // Get monitoring setting from application context.

            UmCtxCreate();

            UmSrcCreate();
            Thread.Sleep(200); // Allow TR to work.

            _messageHeader = _appId + ","
                             + ThisHostIpAddress() + ","
                             + Process.GetCurrentProcess().Id + ","
                             + _objectId;

            _timeOfDay = new TmonGetTimeOfDay();

            // Send monitoring message that context is created.
            _messageBuffer.Clear();
            _messageBuffer.Append('T'); _messageBuffer.Append(',');
            _messageBuffer.Append(GetMessageHeader());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetSec());
            _messageBuffer.Append(','); _messageBuffer.Append(_timeOfDay.GetUsec());
            _messageBuffer.Append(','); _messageBuffer.Append(_appContextName);

            _tmonUmSource.send(Encoding.ASCII.GetBytes(_messageBuffer.ToString()), _messageBuffer.Length, 0);
        } // InitSender