Exemplo n.º 1
0
        public bool ServiceStart()
        {
            SentBytes     = new Gauge64();
            SentMessages  = new Gauge64();
            ReceivedBytes = new Gauge64();

            _outChannel = new PipelineChannel();
            _outChannel.Setup(_remoteUri, _localUri, _contextThreads);
            _outChannel.MessageReceived += OutChannelMessageReceived;
            _outChannel.Start();
            return(true);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IChannel ch = new PipelineChannel();

            thro_each = 10000;
            var in_interface = "tcp://*:8765";       /// recibo las respuestas
            //var out_address = "tcp://127.0.0.1:5678"; /// envio los pedidos
            var out_address = "tcp://10.8.0.1:5678"; /// envio los pedidos

            ch.Setup(out_address, in_interface, 12);
            ch.MessageReceived += ch_MessageReceived;
            ch.Start();

            var send_seq = 0;

            Console.Out.WriteLine("Presione una CTRL+BREAK para salir!");

            while (true)
            {
                var xmlmsg = "";

                /*if (ventana > 100)
                 * {
                 *  Thread.Sleep(50);
                 * }
                 * if (ventana > 2000)
                 * {
                 *  while(ventana > 1500) Thread.Sleep(500);
                 *  continue;
                 * }*/
                if ((enviados++) % 1000 == 0)
                {
                    xmlmsg = "<token t='" + DateTime.Now.Ticks + "'/>";
                }
                else
                {
                    xmlmsg = "<message label='jelo guor' q='" + (send_seq++) + "'/>";
                    ventana++;
                }
                var msg = Encoding.ASCII.GetBytes(xmlmsg);
                if (!ch.Send(msg))
                {
                    Thread.Sleep(100);
                    continue;
                }
            }
        }