标签:
mac下似乎有问题
debian下,安装库
sudo apt-get install libzmq-dev
go get github.com/alecthomas/gozmq
demo代码
package main import "fmt" import zmq "github.com/alecthomas/gozmq" func main() { context, _ := zmq.NewContext() socket, _ := context.NewSocket(zmq.REQ) socket.Connect("tcp://127.0.0.1:5000") socket.Connect("tcp://127.0.0.1:6000") for i := 0; i < 10; i++ { msg := fmt.Sprintf("msg %d", i) socket.Send([]byte(msg), 0) println("Sending", msg) socket.Recv(0) } }
标签:
原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/5040752.html