/* start a Daemon communicating over 2 ports over ZMQ Rep/Req */ func GoShareZMQ(ip string, reply_ports []int) { fmt.Printf("starting ZeroMQ REP/REQ at %v\n", reply_ports) runtime.GOMAXPROCS(runtime.NumCPU()) socket := golzmq.ZmqReplySocket(ip, reply_ports) goShareZmqRep(socket) }
func ZmqReply(ip string, ports []int, fn golzmq.RecieveArrayReturnString) { socket := golzmq.ZmqReplySocket(ip, ports) for { err := golzmq.ZmqReply(socket, fn) if err != nil { panic(err) } } }
/* proxySource create a ZMQ Proxy Reader from source of Proxy */ func proxySource(engine *EngineDetail) error { socket := golzmq.ZmqReplySocket(engine.SourceIP, engine.SourcePorts) replyHandler := func(request []byte) []byte { return channelForRequest(engine, request) } for { errorReply := golzmq.ZmqReplyByte(socket, replyHandler) if errorReply != nil { fmt.Println("ERROR:", errorReply) return errorReply } } return nil }