Cross-language compatibility of ZeroMQ sockets

I have created a python based application based on , but now I am facing performance issues. So I decided to rewrite some modules of my application using, say, Golang. But when I try to establish messaging between sockets implemented in different languages, nothing works. I searched so far, but I have not found any information about compatibility issues using different languages. ZeroMQ

ZeroMQ

So the question is: Can I use golang to implement a server based ZeroMQand a client written in python to connect to it?
Or do I need to use only one language?

EDIT : here is a typical server and client that I'm trying to work fine

Server:

import zmqctx = zmq.Context()
sock = ctx.socket(zmq.REP)
sock.bind("tcp://*:57000")
msg = sock.recv()

customer:

package main

import (
    zmq "github.com/pebbe/zmq4"
)

func main() {

    ctx, _ := zmq.NewContext()
    sock, _ := ctx.NewSocket(zmq.REQ)

    sock.Connect("tcp://localhost:57000")
    sock.Send("simple message", 0)
}

Server stacks on sock.recv()

+4
source share
2 answers

Programming languages ​​can communicate with each other - yes, you can write a server in Go and a client in Python and associate them with each other.

If you are trying to communicate using raw sockets, look at the documentation for the languages ​​you need and make sure that the serialized data matches the structure.

. Python , Go ( Go /stdlib-, ). , , , - , - ZeroMQ.

, . Python ZeroMQ, - , Go , Python.

Go ZeroMQ, Python ZeroMQ, .

+3

, , 0mq golang-to-python.

golang zmq zmq4, :

import (
    zmq4 "github.com/pebbe/zmq4"
)

func main() {

    ctx, _ := zmq4.NewContext()
    sock, _ := ctx.NewSocket(zmq4.REQ)

    sock.Connect("tcp://localhost:57000")
    sock.Send("simple message", 0)
}
+1

All Articles