本文整理匯總了Golang中github.com/kildevaeld/projects/Godeps/_workspace/src/github.com/pebbe/zmq4.Socket.GetRcvmore方法的典型用法代碼示例。如果您正苦於以下問題:Golang Socket.GetRcvmore方法的具體用法?Golang Socket.GetRcvmore怎麽用?Golang Socket.GetRcvmore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/kildevaeld/projects/Godeps/_workspace/src/github.com/pebbe/zmq4.Socket
的用法示例。
在下文中一共展示了Socket.GetRcvmore方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: dump
func dump(soc *zmq.Socket) {
fmt.Println("----------------------------------------")
for {
// Process all parts of the message
message, _ := soc.Recv(0)
// Dump the message as text or binary
fmt.Printf("[%03d] ", len(message))
if all_char.MatchString(message) {
fmt.Print(message)
} else {
for i := 0; i < len(message); i++ {
fmt.Printf("%02X ", message[i])
}
}
fmt.Println()
more, _ := soc.GetRcvmore()
if !more {
break
}
}
}
示例2: bounce
func bounce(server, client *zmq.Socket, willfail bool) {
content := "12345678ABCDEFGH12345678abcdefgh"
// Send message from client to server
rc, err := client.Send(content, zmq.SNDMORE|zmq.DONTWAIT)
if checkErr0(err, 1) {
return
}
if rc != 32 {
checkErr0(errors.New("rc != 32"), 2)
}
rc, err = client.Send(content, zmq.DONTWAIT)
if checkErr0(err, 3) {
return
}
if rc != 32 {
checkErr0(errors.New("rc != 32"), 4)
}
// Receive message at server side
msg, err := server.Recv(0)
if checkErr0(e(err, willfail), 5) {
return
}
// Check that message is still the same
if msg != content {
checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 6)
}
rcvmore, err := server.GetRcvmore()
if checkErr0(err, 7) {
return
}
if !rcvmore {
checkErr0(errors.New(fmt.Sprint("rcvmore ==", rcvmore)), 8)
return
}
// Receive message at server side
msg, err = server.Recv(0)
if checkErr0(err, 9) {
return
}
// Check that message is still the same
if msg != content {
checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 10)
}
rcvmore, err = server.GetRcvmore()
if checkErr0(err, 11) {
return
}
if rcvmore {
checkErr0(errors.New(fmt.Sprint("rcvmore == ", rcvmore)), 12)
return
}
// The same, from server back to client
// Send message from server to client
rc, err = server.Send(content, zmq.SNDMORE)
if checkErr0(err, 13) {
return
}
if rc != 32 {
checkErr0(errors.New("rc != 32"), 14)
}
rc, err = server.Send(content, 0)
if checkErr0(err, 15) {
return
}
if rc != 32 {
checkErr0(errors.New("rc != 32"), 16)
}
// Receive message at client side
msg, err = client.Recv(0)
if checkErr0(err, 17) {
return
}
// Check that message is still the same
if msg != content {
checkErr0(errors.New(fmt.Sprintf("%q != %q", msg, content)), 18)
}
rcvmore, err = client.GetRcvmore()
if checkErr0(err, 19) {
return
}
if !rcvmore {
checkErr0(errors.New(fmt.Sprint("rcvmore ==", rcvmore)), 20)
return
}
//.........這裏部分代碼省略.........