我应该如何处理同一主机上同一端口上的多个发布者? [英] How should I handle multiple publishers on the same port on the same host?

查看:26
本文介绍了我应该如何处理同一主机上同一端口上的多个发布者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 cluster 模块,并且在每个工作进程中,我需要将某些值发布到单个服务器,该服务器订阅每个工作人员.

I am using the cluster module and in each of the worker processes I need to publish certain values out to a single server, which subscribes to each worker.

我在每个工作进程中使用 zmq PUB 套接字,但是当每个工作套接字绑定在同一个端口上时,它会导致冲突并且不起作用.我应该使用什么套接字模式,以便我可以从我的工作进程发布/推送/发送值并使用我的服务器进程订阅它们?

I am using the zmq PUB socket in each worker process, but when each worker socket binds on the same port it causes a conflict and doesn't work. What socket pattern should I use so that I can publish/push/send values from my worker processes and subscribe to them with my server process?

推荐答案

反转发布-订阅绑定-连接.Sub 绑定和 Pub 连接解决了这个问题.

Reverse the pub-sub bind-connect. Sub binds and Pub connects solves the problem.

这篇关于我应该如何处理同一主机上同一端口上的多个发布者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆