You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the zmq the server or client close never cause another one close
but the the below happen
i do not key why
could not receive message : read tcp 127.0.0.1:57509->127.0.0.1:5563: wsarecv: An existing connection was forcibly closed by the remote host.
server
package main
import (
"context"
"log"
"time"
"github.com/go-zeromq/zmq4"
)
func main() {
log.SetPrefix("psenvpub: ")
// prepare the publisher
pub := zmq4.NewPub(context.Background())
defer pub.Close()
err := pub.Listen("tcp://*:5563")
if err != nil {
log.Fatalf("could not listen: %v", err)
}
msgA := zmq4.NewMsgFrom(
[]byte("A"),
[]byte("We don't want to see this"),
)
msgB := zmq4.NewMsgFrom(
[]byte("B"),
[]byte("We would like to see this"),
)
for {
// Write two messages, each with an envelope and content
err = pub.Send(msgA)
if err != nil {
log.Fatal(err)
}
err = pub.Send(msgB)
if err != nil {
log.Fatal(err)
}
time.Sleep(time.Second)
}
}
client
package main
import (
"context"
"log"
"github.com/go-zeromq/zmq4"
)
func main() {
log.SetPrefix("psenvsub: ")
// Prepare our subscriber
sub := zmq4.NewSub(context.Background())
defer sub.Close()
err := sub.Dial("tcp://localhost:5563")
if err != nil {
log.Fatalf("could not dial: %v", err)
}
err = sub.SetOption(zmq4.OptionSubscribe, "B")
if err != nil {
log.Fatalf("could not subscribe: %v", err)
}
for {
// Read envelope
msg, err := sub.Recv()
if err != nil {
log.Println("could not receive message :", err)
}
log.Printf("[%s] %s\n", msg.Frames[0], msg.Frames[1])
}
}
The text was updated successfully, but these errors were encountered:
in the zmq the server or client close never cause another one close
but the the below happen
i do not key why
could not receive message : read tcp 127.0.0.1:57509->127.0.0.1:5563: wsarecv: An existing connection was forcibly closed by the remote host.
server
package main
import (
"context"
"log"
"time"
)
func main() {
log.SetPrefix("psenvpub: ")
}
client
package main
import (
"context"
"log"
)
func main() {
log.SetPrefix("psenvsub: ")
}
The text was updated successfully, but these errors were encountered: