本文整理匯總了Golang中github.com/kildevaeld/projects/Godeps/_workspace/src/github.com/pebbe/zmq4.Socket.SendMessage方法的典型用法代碼示例。如果您正苦於以下問題:Golang Socket.SendMessage方法的具體用法?Golang Socket.SendMessage怎麽用?Golang Socket.SendMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kildevaeld/projects/Godeps/_workspace/src/github.com/pebbe/zmq4.Socket
的用法示例。
在下文中一共展示了Socket.SendMessage方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: echo
// Echo service
func echo(socket *zmq.Socket) (err error) {
msg, err := socket.RecvMessage(0)
if err != nil {
return
}
_, err = socket.SendMessage(msg)
return
}
示例2: ping
func (server *server_t) ping(socket *zmq.Socket) {
if time.Now().After(server.ping_at) {
socket.SendMessage(server.endpoint, "PING")
server.ping_at = time.Now().Add(PING_INTERVAL)
}
}
示例3: Send
// Send key-value message to socket; any empty frames are sent as such.
func (kvmsg *Kvmsg) Send(socket *zmq.Socket) (err error) {
//fmt.Printf("Send to %s: %q\n", socket, kvmsg.frame)
kvmsg.encode_props()
_, err = socket.SendMessage(kvmsg.frame)
return
}