NetMQ——推拉模式 Push-Pull

推送端

 using (var pushSocket = new PushSocket("@tcp://127.0.0.1:1212"))
            {
                while (true)
                {
                    //pushSocket.Connect();
                    string str = Console.ReadLine();
                    pushSocket.SendFrame(str);
                }
            
                         
            }

拉取端

 using (var receiver = new PullSocket(">tcp://127.0.0.1:1212"))
            //using (var sender = new PushSocket(">tcp://localhost:5558"))
            {
                //receiver.
                //process tasks forever
                while (true)
                {
                  
                    string workload = receiver.ReceiveFrameString();
                   
                    Console.WriteLine(workload);
                
                }
            }

 

posted @ 2019-07-19 17:52  乌柒柒  阅读(513)  评论(0编辑  收藏  举报