示例#1
0
        protected override void DoWork(NetMQSocket socket)
        {
            var received = socket.ReceiveStringMessages().ToList();

            Console.WriteLine("Worker received: ");

            for (var i = 0; i < received.Count; i++)
            {
                var r = received[i];
                Console.WriteLine("{0}: {1}", i, r);
            }

            Console.WriteLine("------");
        }
示例#2
0
        protected override void DoClient(int id, NetMQSocket socket)
        {
            const string value    = "Hello World";
            var          expected = value + " " + id;

            Console.WriteLine("Client: {0} sending: {1}", id, expected);
            socket.Send(expected);

            Thread.Sleep(Random.Next(1, 50));

            var response = socket.ReceiveStringMessages().ToList();

            Assert.AreEqual(1, response.Count);
            Assert.AreEqual(expected, response[0]);
            Console.WriteLine("Client: {0} received: {1}", id, response[0]);
        }
示例#3
0
        protected override void DoWork(NetMQSocket socket)
        {
            var received = socket.ReceiveStringMessages().ToList();

            for (var i = 0; i < received.Count; i++)
            {
                if (i == received.Count - 1)
                {
                    socket.Send(received[i]);
                }
                else
                {
                    socket.SendMore(received[i]);
                }
            }
        }