Пример #1
0
        /// <summary>
        /// 三经典模式:推拉模式(管道模式)
        /// 一个消息只能被消费一次
        /// </summary>
        static void PushPull()
        {
            using (var pullSocket = new PullSocket())
                using (var pushSocket = new PushSocket())
                {
                    var port = pullSocket.BindRandomPort($"{address}");
                    pushSocket.Connect($"{address}:" + port);

                    pushSocket.SendMoreFrame("hello").SendFrame("hello world");
                    var s = pullSocket.ReceiveFrameString();
                    s += pullSocket.ReceiveFrameString();
                    Console.WriteLine(s);//hellohello world
                }
        }