Closed tgbv closed 3 years ago
A Req requires a response:
package main
import (
"log"
"gopkg.in/zeromq/goczmq.v4"
)
func main() {
// New socket for request
sock, err := goczmq.NewReq("tcp://127.0.0.1:81")
if err != nil {
panic(err)
}
// send message to Response server
err = sock.SendFrame([]byte("message"), 0)
if err != nil {
panic(err)
}
log.Print("sent")
// make slice for response and wait for it from Response server
res := make([]byte, 32)
i, err := sock.Read(res)
if err != nil {
panic(err)
}
log.Print("read", i, res)
}
I'm using gopkg.in/zeromq/goczmq.v4
I need to send a Req to a Node ZMQ Res server. Assuming the server is started.
I've tested 3 methods which made sense to me, all of them returned error:
How do I properly send a simple req? What am I missing?