本文整理汇总了Golang中github.com/pebbe/zmq3.Socket.GetRcvmore方法的典型用法代码示例。如果您正苦于以下问题:Golang Socket.GetRcvmore方法的具体用法?Golang Socket.GetRcvmore怎么用?Golang Socket.GetRcvmore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pebbe/zmq3.Socket
的用法示例。
在下文中一共展示了Socket.GetRcvmore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) (msg string, err error) {
content := "12345678ABCDEFGH12345678abcdefgh"
// Send message from client to server
rc, err := client.Send(content, zmq.SNDMORE|zmq.DONTWAIT)
if err != nil {
return "client.Send SNDMORE|DONTWAIT:", err
}
if rc != 32 {
return "client.Send SNDMORE|DONTWAIT:", err32
}
rc, err = client.Send(content, zmq.DONTWAIT)
if err != nil {
return "client.Send DONTWAIT:", err
}
if rc != 32 {
return "client.Send DONTWAIT:", err32
}
// Receive message at server side
msg, err = server.Recv(0)
if err != nil {
return "server.Recv 1:", err
}
// Check that message is still the same
if msg != content {
return "server.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content))
}
rcvmore, err := server.GetRcvmore()
if err != nil {
return "server.GetRcvmore 1:", err
}
if !rcvmore {
return "server.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore))
}
// Receive message at server side
msg, err = server.Recv(0)
if err != nil {
return "server.Recv 2:", err
}
// Check that message is still the same
if msg != content {
return "server.Recv 2:", errors.New(fmt.Sprintf("%q != %q", msg, content))
}
rcvmore, err = server.GetRcvmore()
if err != nil {
return "server.GetRcvmore 2:", err
}
if rcvmore {
return "server.GetRcvmore 2:", errors.New(fmt.Sprint("rcvmore == ", rcvmore))
}
// The same, from server back to client
// Send message from server to client
rc, err = server.Send(content, zmq.SNDMORE)
if err != nil {
return "server.Send SNDMORE:", err
}
if rc != 32 {
return "server.Send SNDMORE:", err32
}
rc, err = server.Send(content, 0)
if err != nil {
return "server.Send 0:", err
}
if rc != 32 {
return "server.Send 0:", err32
}
// Receive message at client side
msg, err = client.Recv(0)
if err != nil {
return "client.Recv 1:", err
}
// Check that message is still the same
if msg != content {
return "client.Recv 1:", errors.New(fmt.Sprintf("%q != %q", msg, content))
}
rcvmore, err = client.GetRcvmore()
if err != nil {
return "client.GetRcvmore 1:", err
}
if !rcvmore {
return "client.GetRcvmore 1:", errors.New(fmt.Sprint("rcvmore ==", rcvmore))
}
// Receive message at client side
msg, err = client.Recv(0)
if err != nil {
//.........这里部分代码省略.........
示例3: bounce
func bounce(server, client *zmq.Socket) {
content := "12345678ABCDEFGH12345678abcdefgh"
// Send message from client to server
rc, err := client.Send(content, zmq.SNDMORE)
if checkErr(err) {
return
}
if rc != 32 {
checkErr(errors.New("rc != 32"))
}
rc, err = client.Send(content, 0)
if checkErr(err) {
return
}
if rc != 32 {
checkErr(errors.New("rc != 32"))
}
// Receive message at server side
msg, err := server.Recv(0)
if checkErr(err) {
return
}
// Check that message is still the same
if msg != content {
checkErr(errors.New(fmt.Sprintf("%q != %q", msg, content)))
}
rcvmore, err := server.GetRcvmore()
if checkErr(err) {
return
}
if !rcvmore {
checkErr(errors.New(fmt.Sprint("rcvmore ==", rcvmore)))
return
}
// Receive message at server side
msg, err = server.Recv(0)
if checkErr(err) {
return
}
// Check that message is still the same
if msg != content {
checkErr(errors.New(fmt.Sprintf("%q != %q", msg, content)))
}
rcvmore, err = server.GetRcvmore()
if checkErr(err) {
return
}
if rcvmore {
checkErr(errors.New(fmt.Sprint("rcvmore == ", rcvmore)))
return
}
// The same, from server back to client
// Send message from server to client
rc, err = server.Send(content, zmq.SNDMORE)
if checkErr(err) {
return
}
if rc != 32 {
checkErr(errors.New("rc != 32"))
}
rc, err = server.Send(content, 0)
if checkErr(err) {
return
}
if rc != 32 {
checkErr(errors.New("rc != 32"))
}
// Receive message at client side
msg, err = client.Recv(0)
if checkErr(err) {
return
}
// Check that message is still the same
if msg != content {
checkErr(errors.New(fmt.Sprintf("%q != %q", msg, content)))
}
rcvmore, err = client.GetRcvmore()
if checkErr(err) {
return
}
if !rcvmore {
checkErr(errors.New(fmt.Sprint("rcvmore ==", rcvmore)))
return
}
//.........这里部分代码省略.........