I am new to zeroMQ and am trying to create a server (with router socket bound to a local port) and a client with a dealer socket which connects to the router socket on the local port. The client sends data and exits, however nothing shows up on the router socket i.e. the Recv(0) call blocks forever. The server and client codes are as follows:
zmserver.go:
package main
import ("fmt"
zmq "github.com/pebbe/zmq4")
func main() {
fmt.Println("Starting server")
serversock, _ := zmq.NewSocket(zmq.ROUTER)
serversock.Bind("tcp://*:5050")
identity, _ := serversock.Recv(0)
fmt.Println(identity) //nothing is printed
fmt.Println(serversock.Recv(0)) //nothing is printed
fmt.Println(serversock.Recv(0)) //nothing is printed
}
zmclient.go:
package main
import ("fmt"
zmq "github.com/pebbe/zmq4")
func main(){
fmt.Println("Starting client")
clientsock, _ := zmq.NewSocket(zmq.DEALER)
defer clientsock.Close()
clientsock.SetIdentity("ID1")
clientsock.Connect("tcp://localhost:5050")
clientsock.Send("", zmq.SNDMORE)
clientsock.Send("Hi Boss", 0)
}