1. <legend id='YJtII'><style id='YJtII'><dir id='YJtII'><q id='YJtII'></q></dir></style></legend>

      <tfoot id='YJtII'></tfoot>

        <i id='YJtII'><tr id='YJtII'><dt id='YJtII'><q id='YJtII'><span id='YJtII'><b id='YJtII'><form id='YJtII'><ins id='YJtII'></ins><ul id='YJtII'></ul><sub id='YJtII'></sub></form><legend id='YJtII'></legend><bdo id='YJtII'><pre id='YJtII'><center id='YJtII'></center></pre></bdo></b><th id='YJtII'></th></span></q></dt></tr></i><div id='YJtII'><tfoot id='YJtII'></tfoot><dl id='YJtII'><fieldset id='YJtII'></fieldset></dl></div>
          <bdo id='YJtII'></bdo><ul id='YJtII'></ul>
      1. <small id='YJtII'></small><noframes id='YJtII'>

      2. 为什么 zeromq 在 localhost 上不起作用?

        Why doesn#39;t zeromq work on localhost?(为什么 zeromq 在 localhost 上不起作用?)

          <i id='GkrKV'><tr id='GkrKV'><dt id='GkrKV'><q id='GkrKV'><span id='GkrKV'><b id='GkrKV'><form id='GkrKV'><ins id='GkrKV'></ins><ul id='GkrKV'></ul><sub id='GkrKV'></sub></form><legend id='GkrKV'></legend><bdo id='GkrKV'><pre id='GkrKV'><center id='GkrKV'></center></pre></bdo></b><th id='GkrKV'></th></span></q></dt></tr></i><div id='GkrKV'><tfoot id='GkrKV'></tfoot><dl id='GkrKV'><fieldset id='GkrKV'></fieldset></dl></div>
          <legend id='GkrKV'><style id='GkrKV'><dir id='GkrKV'><q id='GkrKV'></q></dir></style></legend>

            <tbody id='GkrKV'></tbody>
          • <small id='GkrKV'></small><noframes id='GkrKV'>

              <bdo id='GkrKV'></bdo><ul id='GkrKV'></ul>
                  <tfoot id='GkrKV'></tfoot>
                1. 本文介绍了为什么 zeromq 在 localhost 上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  This code works great:

                  import zmq, json, time
                  
                  def main():
                      context = zmq.Context()
                      subscriber = context.socket(zmq.SUB)
                      subscriber.bind("ipc://test")
                      subscriber.setsockopt(zmq.SUBSCRIBE, '')
                      while True:
                          print subscriber.recv()
                  
                  def main():
                      context = zmq.Context()
                      publisher = context.socket(zmq.PUB)
                      publisher.connect("ipc://test")
                      while True:
                          publisher.send( "hello world" )
                          time.sleep( 1 )
                  

                  But this code doesn't* work:

                  import zmq, json, time
                  
                  def recv():
                      context = zmq.Context()
                      subscriber = context.socket(zmq.SUB)
                      subscriber.bind("tcp://localhost:5555")
                      subscriber.setsockopt(zmq.SUBSCRIBE, '')
                      while True:
                          print subscriber.recv()
                  
                  def send():
                      context = zmq.Context()
                      publisher = context.socket(zmq.PUB)
                      publisher.connect("tcp://localhost:5555")
                      while True:
                          publisher.send( "hello world" )
                          time.sleep( 1 )
                  

                  It raises this error:

                  ZMQError: No such device

                  Why, can't zeromq use localhost interfaces?

                  Does it only work on IPC on the same machine?

                  解决方案

                  The problem is at line:

                  subscriber.bind("tcp://localhost:5555")
                  

                  try to change to:

                  subscriber.bind("tcp://127.0.0.1:5555")
                  

                  这篇关于为什么 zeromq 在 localhost 上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)

                    <small id='wGdED'></small><noframes id='wGdED'>

                    <tfoot id='wGdED'></tfoot>

                          <i id='wGdED'><tr id='wGdED'><dt id='wGdED'><q id='wGdED'><span id='wGdED'><b id='wGdED'><form id='wGdED'><ins id='wGdED'></ins><ul id='wGdED'></ul><sub id='wGdED'></sub></form><legend id='wGdED'></legend><bdo id='wGdED'><pre id='wGdED'><center id='wGdED'></center></pre></bdo></b><th id='wGdED'></th></span></q></dt></tr></i><div id='wGdED'><tfoot id='wGdED'></tfoot><dl id='wGdED'><fieldset id='wGdED'></fieldset></dl></div>
                          <legend id='wGdED'><style id='wGdED'><dir id='wGdED'><q id='wGdED'></q></dir></style></legend>

                            <tbody id='wGdED'></tbody>
                            <bdo id='wGdED'></bdo><ul id='wGdED'></ul>