Created
July 16, 2013 09:03
-
-
Save fatih/6007099 to your computer and use it in GitHub Desktop.
Zmq REP client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
zmq "github.com/pebbe/zmq3" | |
) | |
func main() { | |
responder, _ := zmq.NewSocket(zmq.REP) | |
defer responder.Close() | |
responder.SetIdentity("1123581321") //key to be used | |
responder.Connect("tcp://127.0.0.1:10001") | |
for { | |
msg, _ := responder.RecvMessage(0) | |
reqId := msg[0] | |
data := msg[1] | |
// data contains "Hello, World" | |
result := []string{reqId, string("Hello, ZMQ")} | |
responder.SendMessage(result, 0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment