> For a PAIR socket, between 2 threads, does the binder need to bind before the > connector connects?
Depends on libzmq's version. With current trunk it works. I believe it also works in 4.1. Not sure though. > Can the sender close the socket as soon as they have send_pyobj, and the > other thread would receive anyways? I don't know if send_pyobj() is special (I don't know much about GC / refcounting in Python), but I believe it should be alright. On Fri, Sep 18, 2015 at 4:13 PM, MM <[email protected]> wrote: > > > On 3 September 2015 at 15:58, MM <[email protected]> wrote: >> >> hello >> >> I have: >> >> def thread1(): >> s = context.socket(zmq.PAIR) >> s.bind('inproc://name') >> s.send_pyobj( dictionary ) >> ### That's all I need to do , can I close s here? >> while True: >> # stay alive forever >> >> def thread2(): >> s = context.socket(zmq.PAIR) >> s.connect('inproc://name') >> dx = s.recv_pyobj() >> while True: >> # stay alive forever >> >> def main(): >> Thread(....thread1..).start() >> time.sleep(5) #5secs >> Thread(....thread2..).start() >> #wait for signals >> >> >> thread1 is the parent one, proceeds independently. >> thread2 can only proceed once it got the dictionary from thread1 >> >> 1. do I need the sleep(5) in the main thread to ensure thread1 bind >> happens before thread2 connect? >> 2. can I close s in thread1 as soon as I send the dictionary? >> >> Thanks, > > > Apologies if the answers to these questions are in the manual, I couldn't > see them. > > For a PAIR socket, between 2 threads, does the binder need to bind before > the connector connects? > Can the sender close the socket as soon as they have send_pyobj, and the > other thread would receive anyways? > > Regards, > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > -- Kapp Arnaud - Xaqq _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
