添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am using go and zmg library github.com/zeromq/goczmq

From go I can send messages to a tcp socket and can be read from python:

In go:

pubEndpoint := "tcp://127.0.0.1:7000"
pubSock, err := goczmq.NewPub(pubEndpoint)
if err != nil {
    log.Fatal(err)
defer pubSock.Destroy()
pubSock.Bind(pubEndpoint)
for {
    err = pubSock.SendFrame([]byte("stream hello"), goczmq.FlagNone)

In python:

context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect("tcp://127.0.0.1:%s"%port)
print ('port:',port)
socket.setsockopt(zmq.SUBSCRIBE, "stream")
while True:
    transpport = socket.recv()
    transpport = transpport.split('stream ')[1]
    print (transpport)

Now if I change from tcp to icp for both I get no errors but the python code is not printing the data.

Now in python publisher and subscriber works over ipc. I am trying to refactor my publisher to use Go but prefer to use ipc over tcp.

So in sum tcp works from go --> python Ipc throws no errors but python is not picking up data

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.