c# 使用zeromq

1.安装NETMQ  (nuget)

测试代码

    static void zmqClient()
        {

            // using (var responseSocket = new ResponseSocket("@tcp://*:5555"))
            using (var requestSocket = new RequestSocket(">tcp://localhost:5560"))
            {
                Console.WriteLine("client send 'hello'");
                requestSocket.SendFrame("hello");

                var message = requestSocket.ReceiveFrameString();
                Console.WriteLine("requestSocket : Received '{0}'", message);

                Console.ReadLine();
            }
        }


        static void zmqServer()
        {
            using (var responseSocket = new ResponseSocket("@tcp://*:5560"))
            for(;;)
            {
                var message = responseSocket.ReceiveFrameString();
                Console.WriteLine("server recv {0}", message);
                Console.WriteLine("server send world");
                responseSocket.SendFrame("world");
            }
        }



        static void Main(string[] args)
        {
            zmqServer();
        }

 

你可能感兴趣的:(c# 使用zeromq)