Re: [zeromq-dev] ZMQError: Resource temporarily unavailable
On Wed, Oct 8, 2014 at 1:11 PM, Karthik Sharma karthik.sha...@gmail.com wrote: I have an zmq function as below def recieve_messages(self): string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) When I run the program however I get the following error. string = self.sub_socket.recv(flags=zmq.NOBLOCK) File socket.pyx, line 616, in zmq.core.socket.Socket.recv (zmq/core/socket.c:5961) File socket.pyx, line 650, in zmq.core.socket.Socket.recv (zmq/core/socket.c:5832) File socket.pyx, line 119, in zmq.core.socket._recv_copy (zmq/core/socket.c:1669) ZMQError: Resource temporarily unavailable Can someone explain what is likely causing this error. There is no message to receive. That's what NOBLOCK means – it will always finish immediately, either returning a message if there is one, or raising ZMQError(EAGAIN) if there is not. -MinRK Regards, Karthik. ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] PyZMQ with Libsodium on Windows?
Hi again! OK, so I managed building libsodium on Windows with MSVC 2008 to match Python 2.7. Simply required creating a VS solution and include all the source files. The only problems I ran into are: 1) stdint.h is not provided with MSVC 2008, so I added a stub for it within the solution in order to build; and 2) there are some static inline function declarations which are rejected by the compiler, so I removed the inline (which is optional). So I now have a libsodium.lib and a libsodium.dll. Once I have a proof of concept that's working inside PyZMQ, I'll see if I can get this MSVC 2008 solution included upstream in libsodium. However, I'm not familiar with Python bundling process. How should I provide the libsodium headers, lib dll files to PyZMQ? What commands do you run to create the PyZMQ egg and whl bundles once I've made libsodium available to PyZMQ? Thanks, André On Fri, Oct 10, 2014 at 5:36 AM, Frank Hartmann sound...@gmx.net wrote: Hi, Tweetnacl linux integration has been added to libzmq some month ago. You could try compiling with tweetnacl and VS2008. One(only?) thing missing is randombytes() function on windows. Probably MS has a crypto API somewhere which should make this simple, if you trust them. And you can check how libsodium does it. regards Frank Min RK benjami...@gmail.com writes: For pyzmq, it must work with VC9 (VS2008), for Python 2.7. -MinRK On Oct 9, 2014, at 18:08, Steven McCoy steven.mc...@miru.hk wrote: I think it is easier now as they have more support than just MSVC2013 (C99 compat) when crypto was added to ZeroMQ. On 9 October 2014 17:47, MinRK benjami...@gmail.com wrote: It's not bundled simply because I couldn't build it on Windows. If you can come up with a simple fix for building bundled libsodium, then I would bundle libsodium on Windows. -MinRK On Thu, Oct 9, 2014 at 1:48 PM, André Caron andre.l.ca...@gmail.com wrote: Hi there! I'm trying to secure some PyZMQ communications with the curve security features. The code seems straightforward, but when I call `zmq.auth.create_certificates()` to generate some keys, I get the following exception: zmq.error.ZMQError: Not supported This seems to be due to the absence of libsodium. In the release notes for PyZMQ 14.1.0, I can see that libsodium is not bundled with PyZMQ on Windows. First, I'm curious to know why it's not bundled on Windows. If it's simply a matter of finding a volunteer, maybe I can pitch in? Second, I'd like to know if there's any known procedure to get it running on Windows? Thanks! André ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[zeromq-dev] simple publish subscribe not working with zeromq
I want to establish publish subscribe communication between to machines.The two machines that I have are `ryu-primary` and `ryu-secondary` The steps I follow in each of the machines are as follows.In the initializer for `ryu-primary` (IP address is 192.168.241.131) self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.132:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): self.pub_socket.send(%s % (msg)) From ryu-secondary (IP address - 192.168.241.132) In the initializer self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.131:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): print('pushing message to publish socket') self.pub_socket.send(%s % (msg)) These are the functions that I have. I am calling establish_zmq_connections() push_messages() from `ryu-secondary`, But I am not recieving those messages when I am calling listen_zmq_connection() recieve_messages() from `ryu-primary`. Can someone point out to me what I am doing wrong? ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] simple publish subscribe not working with zeromq
Hi Karthik, You need to subscribe to a topic, not merely connect. You can subscribe to an empty string to receive all messages. E.g.: sub_socket.setsockopt(zmq.SUBSCRIBE, '') On Sat, Oct 11, 2014, at 04:16 PM, Karthik Sharma wrote: I want to establish publish subscribe communication between to machines.The two machines that I have are `ryu-primary` and `ryu-secondary` The steps I follow in each of the machines are as follows.In the initializer for `ryu-primary` (IP address is 192.168.241.131) self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.132:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): self.pub_socket.send(%s % (msg)) From ryu-secondary (IP address - 192.168.241.132) In the initializer self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.131:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): print('pushing message to publish socket') self.pub_socket.send(%s % (msg)) These are the functions that I have. I am calling establish_zmq_connections() push_messages() from `ryu-secondary`, But I am not recieving those messages when I am calling listen_zmq_connection() recieve_messages() from `ryu-primary`. Can someone point out to me what I am doing wrong? ___ zeromq-dev mailing list [1]zeromq-dev@lists.zeromq.org [2]http://lists.zeromq.org/mailman/listinfo/zeromq-dev References 1. mailto:zeromq-dev@lists.zeromq.org 2. http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] PyZMQ with Libsodium on Windows?
PyZMQ builds libzmq (and libsodium) as Python extensions, using the compiler associated with Python (hence the need for VC9, the compiler associated with Python.org 2.7). They are built with `setup.py build_ext`. -MinRK On Sat, Oct 11, 2014 at 1:15 PM, André Caron andre.l.ca...@gmail.com wrote: Hi again! OK, so I managed building libsodium on Windows with MSVC 2008 to match Python 2.7. Simply required creating a VS solution and include all the source files. The only problems I ran into are: 1) stdint.h is not provided with MSVC 2008, so I added a stub for it within the solution in order to build; and 2) there are some static inline function declarations which are rejected by the compiler, so I removed the inline (which is optional). So I now have a libsodium.lib and a libsodium.dll. Once I have a proof of concept that's working inside PyZMQ, I'll see if I can get this MSVC 2008 solution included upstream in libsodium. However, I'm not familiar with Python bundling process. How should I provide the libsodium headers, lib dll files to PyZMQ? What commands do you run to create the PyZMQ egg and whl bundles once I've made libsodium available to PyZMQ? Thanks, André On Fri, Oct 10, 2014 at 5:36 AM, Frank Hartmann sound...@gmx.net wrote: Hi, Tweetnacl linux integration has been added to libzmq some month ago. You could try compiling with tweetnacl and VS2008. One(only?) thing missing is randombytes() function on windows. Probably MS has a crypto API somewhere which should make this simple, if you trust them. And you can check how libsodium does it. regards Frank Min RK benjami...@gmail.com writes: For pyzmq, it must work with VC9 (VS2008), for Python 2.7. -MinRK On Oct 9, 2014, at 18:08, Steven McCoy steven.mc...@miru.hk wrote: I think it is easier now as they have more support than just MSVC2013 (C99 compat) when crypto was added to ZeroMQ. On 9 October 2014 17:47, MinRK benjami...@gmail.com wrote: It's not bundled simply because I couldn't build it on Windows. If you can come up with a simple fix for building bundled libsodium, then I would bundle libsodium on Windows. -MinRK On Thu, Oct 9, 2014 at 1:48 PM, André Caron andre.l.ca...@gmail.com wrote: Hi there! I'm trying to secure some PyZMQ communications with the curve security features. The code seems straightforward, but when I call `zmq.auth.create_certificates()` to generate some keys, I get the following exception: zmq.error.ZMQError: Not supported This seems to be due to the absence of libsodium. In the release notes for PyZMQ 14.1.0, I can see that libsodium is not bundled with PyZMQ on Windows. First, I'm curious to know why it's not bundled on Windows. If it's simply a matter of finding a volunteer, maybe I can pitch in? Second, I'd like to know if there's any known procedure to get it running on Windows? Thanks! André ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] PyZMQ with Libsodium on Windows?
Thanks! I've now modified the setup.py file so that it builds libsodium on Windows. However, I'm running into some conflits with ZeroMQ. First, libzmq defines its own int8_t etc. to work around the absence of stdint.h when building under VS 2008. I'm wondering what the best way to fix this is. Maybe add an #ifndef HAVE_LIBSODIUM around the typedefs in zeromq/src/stdint.hpp? Second, libzmq and libsodium both use the same DLL_EXPORT macro to control visibility of symbols. When building libzmq, this macro is defined, which causes libsodium header files to think they are building libsodium. This causes unresolved external linker errors. I think libzmq should define a ZMQ_DLL_EXPORT macro which is distinct from that used by other libraries. I'll get something working and follow-up. Cheers, André On Sat, Oct 11, 2014 at 8:58 PM, MinRK benjami...@gmail.com wrote: PyZMQ builds libzmq (and libsodium) as Python extensions, using the compiler associated with Python (hence the need for VC9, the compiler associated with Python.org 2.7). They are built with `setup.py build_ext`. -MinRK On Sat, Oct 11, 2014 at 1:15 PM, André Caron andre.l.ca...@gmail.com wrote: Hi again! OK, so I managed building libsodium on Windows with MSVC 2008 to match Python 2.7. Simply required creating a VS solution and include all the source files. The only problems I ran into are: 1) stdint.h is not provided with MSVC 2008, so I added a stub for it within the solution in order to build; and 2) there are some static inline function declarations which are rejected by the compiler, so I removed the inline (which is optional). So I now have a libsodium.lib and a libsodium.dll. Once I have a proof of concept that's working inside PyZMQ, I'll see if I can get this MSVC 2008 solution included upstream in libsodium. However, I'm not familiar with Python bundling process. How should I provide the libsodium headers, lib dll files to PyZMQ? What commands do you run to create the PyZMQ egg and whl bundles once I've made libsodium available to PyZMQ? Thanks, André On Fri, Oct 10, 2014 at 5:36 AM, Frank Hartmann sound...@gmx.net wrote: Hi, Tweetnacl linux integration has been added to libzmq some month ago. You could try compiling with tweetnacl and VS2008. One(only?) thing missing is randombytes() function on windows. Probably MS has a crypto API somewhere which should make this simple, if you trust them. And you can check how libsodium does it. regards Frank Min RK benjami...@gmail.com writes: For pyzmq, it must work with VC9 (VS2008), for Python 2.7. -MinRK On Oct 9, 2014, at 18:08, Steven McCoy steven.mc...@miru.hk wrote: I think it is easier now as they have more support than just MSVC2013 (C99 compat) when crypto was added to ZeroMQ. On 9 October 2014 17:47, MinRK benjami...@gmail.com wrote: It's not bundled simply because I couldn't build it on Windows. If you can come up with a simple fix for building bundled libsodium, then I would bundle libsodium on Windows. -MinRK On Thu, Oct 9, 2014 at 1:48 PM, André Caron andre.l.ca...@gmail.com wrote: Hi there! I'm trying to secure some PyZMQ communications with the curve security features. The code seems straightforward, but when I call `zmq.auth.create_certificates()` to generate some keys, I get the following exception: zmq.error.ZMQError: Not supported This seems to be due to the absence of libsodium. In the release notes for PyZMQ 14.1.0, I can see that libsodium is not bundled with PyZMQ on Windows. First, I'm curious to know why it's not bundled on Windows. If it's simply a matter of finding a volunteer, maybe I can pitch in? Second, I'd like to know if there's any known procedure to get it running on Windows? Thanks! André ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] simple publish subscribe not working with zeromq
Hi Justin, Thanks for the reply.That did work! I have a follow on question. I am tying to send the following structure. msg = {'in_port':in_port,'dst':dst,'actions':actions} self.push_messages(msg) However on the recieving side,I can decode the msg using format(msg) but I can acess the members in the dictionary. print('flow_mod recieved from ryu-primary {}'.format(flow_mod[in_port])) - flow_mod recieved from ryu-primary {'dst': u'00:00:00:00:00:04', 'actions': [OFPActionOutput(max_len=65509,port=2)], 'in_port': 1} self.add_flow(datapath, flow_mod[in_port], flow_mod[dst], flow_mod[actions]) --- doesn't work? -- gives error NameError: global name 'in_port' is not defined Regards, Karthik. On 12 October 2014 12:31, Justin Karneges jus...@affinix.com wrote: Hi Karthik, You need to subscribe to a topic, not merely connect. You can subscribe to an empty string to receive all messages. E.g.: sub_socket.setsockopt(zmq.SUBSCRIBE, '') On Sat, Oct 11, 2014, at 04:16 PM, Karthik Sharma wrote: I want to establish publish subscribe communication between to machines.The two machines that I have are `ryu-primary` and `ryu-secondary` The steps I follow in each of the machines are as follows.In the initializer for `ryu-primary` (IP address is 192.168.241.131) self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.132:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): self.pub_socket.send(%s % (msg)) From ryu-secondary (IP address - 192.168.241.132) In the initializer self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.131:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): print('pushing message to publish socket') self.pub_socket.send(%s % (msg)) These are the functions that I have. I am calling establish_zmq_connections() push_messages() from `ryu-secondary`, But I am not recieving those messages when I am calling listen_zmq_connection() recieve_messages() from `ryu-primary`. Can someone point out to me what I am doing wrong? *___* zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] PyZMQ with Libsodium on Windows?
OK. I got it working. The entire procedure seems to be the following: 1) add a stub stdint.h in libsodium and change use of static inline for static to prevent VS 2008's compiler from choking; 2) change the DLL_EXPORT macro in libzmq to ZMQ_DLL_EXPORT and avoid providing definitions for missing stdint.h under VS 2008 when HAVE_LIBSODIUM is defined; 3) modify PyZMQ's setup.py file to build libsodium and link libzmq against libsodium on Windows. Assuming libsodium's maintainers accept a patch for #1, would you be willing to accept a pull request to patch libzmq (#2) and then another to patch PyZMQ (#3)? Thanks, André On Sat, Oct 11, 2014 at 11:14 PM, André Caron andre.l.ca...@gmail.com wrote: Thanks! I've now modified the setup.py file so that it builds libsodium on Windows. However, I'm running into some conflits with ZeroMQ. First, libzmq defines its own int8_t etc. to work around the absence of stdint.h when building under VS 2008. I'm wondering what the best way to fix this is. Maybe add an #ifndef HAVE_LIBSODIUM around the typedefs in zeromq/src/stdint.hpp? Second, libzmq and libsodium both use the same DLL_EXPORT macro to control visibility of symbols. When building libzmq, this macro is defined, which causes libsodium header files to think they are building libsodium. This causes unresolved external linker errors. I think libzmq should define a ZMQ_DLL_EXPORT macro which is distinct from that used by other libraries. I'll get something working and follow-up. Cheers, André On Sat, Oct 11, 2014 at 8:58 PM, MinRK benjami...@gmail.com wrote: PyZMQ builds libzmq (and libsodium) as Python extensions, using the compiler associated with Python (hence the need for VC9, the compiler associated with Python.org 2.7). They are built with `setup.py build_ext`. -MinRK On Sat, Oct 11, 2014 at 1:15 PM, André Caron andre.l.ca...@gmail.com wrote: Hi again! OK, so I managed building libsodium on Windows with MSVC 2008 to match Python 2.7. Simply required creating a VS solution and include all the source files. The only problems I ran into are: 1) stdint.h is not provided with MSVC 2008, so I added a stub for it within the solution in order to build; and 2) there are some static inline function declarations which are rejected by the compiler, so I removed the inline (which is optional). So I now have a libsodium.lib and a libsodium.dll. Once I have a proof of concept that's working inside PyZMQ, I'll see if I can get this MSVC 2008 solution included upstream in libsodium. However, I'm not familiar with Python bundling process. How should I provide the libsodium headers, lib dll files to PyZMQ? What commands do you run to create the PyZMQ egg and whl bundles once I've made libsodium available to PyZMQ? Thanks, André On Fri, Oct 10, 2014 at 5:36 AM, Frank Hartmann sound...@gmx.net wrote: Hi, Tweetnacl linux integration has been added to libzmq some month ago. You could try compiling with tweetnacl and VS2008. One(only?) thing missing is randombytes() function on windows. Probably MS has a crypto API somewhere which should make this simple, if you trust them. And you can check how libsodium does it. regards Frank Min RK benjami...@gmail.com writes: For pyzmq, it must work with VC9 (VS2008), for Python 2.7. -MinRK On Oct 9, 2014, at 18:08, Steven McCoy steven.mc...@miru.hk wrote: I think it is easier now as they have more support than just MSVC2013 (C99 compat) when crypto was added to ZeroMQ. On 9 October 2014 17:47, MinRK benjami...@gmail.com wrote: It's not bundled simply because I couldn't build it on Windows. If you can come up with a simple fix for building bundled libsodium, then I would bundle libsodium on Windows. -MinRK On Thu, Oct 9, 2014 at 1:48 PM, André Caron andre.l.ca...@gmail.com wrote: Hi there! I'm trying to secure some PyZMQ communications with the curve security features. The code seems straightforward, but when I call `zmq.auth.create_certificates()` to generate some keys, I get the following exception: zmq.error.ZMQError: Not supported This seems to be due to the absence of libsodium. In the release notes for PyZMQ 14.1.0, I can see that libsodium is not bundled with PyZMQ on Windows. First, I'm curious to know why it's not bundled on Windows. If it's simply a matter of finding a volunteer, maybe I can pitch in? Second, I'd like to know if there's any known procedure to get it running on Windows? Thanks! André ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list
Re: [zeromq-dev] simple publish subscribe not working with zeromq
Maybe you mean flow_mod['in_port'] ? On Sat, Oct 11, 2014, at 08:23 PM, Karthik Sharma wrote: Hi Justin, Thanks for the reply.That did work! I have a follow on question. I am tying to send the following structure. msg = {'in_port':in_port,'dst':dst,'actions':actions} self.push_messages(msg) However on the recieving side,I can decode the msg using format(msg) but I can acess the members in the dictionary. print('flow_mod recieved from ryu-primary {}'.format(flow_mod[in_port])) - flow_mod recieved from ryu-primary {'dst': u'00:00:00:00:00:04', 'actions': [OFPActionOutput(max_len=65509,port=2)], 'in_port': 1} self.add_flow(datapath, flow_mod[in_port], flow_mod[dst], flow_mod[actions]) --- doesn't work? -- gives error NameError: global name 'in_port' is not defined Regards, Karthik. On 12 October 2014 12:31, Justin Karneges [1]jus...@affinix.com wrote: Hi Karthik, You need to subscribe to a topic, not merely connect. You can subscribe to an empty string to receive all messages. E.g.: sub_socket.setsockopt(zmq.SUBSCRIBE, '') On Sat, Oct 11, 2014, at 04:16 PM, Karthik Sharma wrote: I want to establish publish subscribe communication between to machines.The two machines that I have are `ryu-primary` and `ryu-secondary` The steps I follow in each of the machines are as follows.In the initializer for `ryu-primary` (IP address is 192.168.241.131) self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.132:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): self.pub_socket.send(%s % (msg)) From ryu-secondary (IP address - 192.168.241.132) In the initializer self.context = zmq.Context() self.sub_socket = self.context.socket(zmq.SUB) self.pub_socket = self.context.socket(zmq.PUB) self.pub_port = 5566 self.sub_port = 5566 def establish_zmq_connection(self): # Socket to talk to server print Connection to ryu-secondary... self.sub_socket.connect (tcp://192.168.241.131:%s % self.sub_port) def listen_zmq_connection(self): print('Listen to zmq connection') self.pub_socket.bind(tcp://*:%s % self.pub_port) def recieve_messages(self): while True: try: string = self.sub_socket.recv(flags=zmq.NOBLOCK) print('flow mod messages recieved {}'.format(string)) return string except zmq.ZMQError: break def push_messages(self,msg): print('pushing message to publish socket') self.pub_socket.send(%s % (msg)) These are the functions that I have. I am calling establish_zmq_connections() push_messages() from `ryu-secondary`, But I am not recieving those messages when I am calling listen_zmq_connection() recieve_messages() from `ryu-primary`. Can someone point out to me what I am doing wrong? ___ zeromq-dev mailing list [2]zeromq-dev@lists.zeromq.org [3]http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list [4]zeromq-dev@lists.zeromq.org [5]http://lists.zeromq.org/mailman/listinfo/zeromq-dev References 1. mailto:jus...@affinix.com 2. mailto:zeromq-dev@lists.zeromq.org 3. http://lists.zeromq.org/mailman/listinfo/zeromq-dev 4. mailto:zeromq-dev@lists.zeromq.org 5. http://lists.zeromq.org/mailman/listinfo/zeromq-dev ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Re: [zeromq-dev] PyZMQ with Libsodium on Windows?
Push a working solution to GitHub. See changes to: 1) libsodium: https://github.com/AndreLouisCaron/libsodium/commits/vs2008 2) libzmq: https://github.com/AndreLouisCaron/libzmq/commits/win-libsodium 3) pyzmq: https://github.com/AndreLouisCaron/pyzmq/commits/win-libsodium I'll submit the pull request for #1 to libsodium and see where that goes. In the meantime, can I ask you to check out #2 and #3 to see if they are likely to get integrated? I understand that all this implies an upgrade from libsodium 0.4.5 to 1.0.0+. Is that OK with you? Thanks, André On Sat, Oct 11, 2014 at 11:43 PM, André Caron andre.l.ca...@gmail.com wrote: OK. I got it working. The entire procedure seems to be the following: 1) add a stub stdint.h in libsodium and change use of static inline for static to prevent VS 2008's compiler from choking; 2) change the DLL_EXPORT macro in libzmq to ZMQ_DLL_EXPORT and avoid providing definitions for missing stdint.h under VS 2008 when HAVE_LIBSODIUM is defined; 3) modify PyZMQ's setup.py file to build libsodium and link libzmq against libsodium on Windows. Assuming libsodium's maintainers accept a patch for #1, would you be willing to accept a pull request to patch libzmq (#2) and then another to patch PyZMQ (#3)? Thanks, André On Sat, Oct 11, 2014 at 11:14 PM, André Caron andre.l.ca...@gmail.com wrote: Thanks! I've now modified the setup.py file so that it builds libsodium on Windows. However, I'm running into some conflits with ZeroMQ. First, libzmq defines its own int8_t etc. to work around the absence of stdint.h when building under VS 2008. I'm wondering what the best way to fix this is. Maybe add an #ifndef HAVE_LIBSODIUM around the typedefs in zeromq/src/stdint.hpp? Second, libzmq and libsodium both use the same DLL_EXPORT macro to control visibility of symbols. When building libzmq, this macro is defined, which causes libsodium header files to think they are building libsodium. This causes unresolved external linker errors. I think libzmq should define a ZMQ_DLL_EXPORT macro which is distinct from that used by other libraries. I'll get something working and follow-up. Cheers, André On Sat, Oct 11, 2014 at 8:58 PM, MinRK benjami...@gmail.com wrote: PyZMQ builds libzmq (and libsodium) as Python extensions, using the compiler associated with Python (hence the need for VC9, the compiler associated with Python.org 2.7). They are built with `setup.py build_ext`. -MinRK On Sat, Oct 11, 2014 at 1:15 PM, André Caron andre.l.ca...@gmail.com wrote: Hi again! OK, so I managed building libsodium on Windows with MSVC 2008 to match Python 2.7. Simply required creating a VS solution and include all the source files. The only problems I ran into are: 1) stdint.h is not provided with MSVC 2008, so I added a stub for it within the solution in order to build; and 2) there are some static inline function declarations which are rejected by the compiler, so I removed the inline (which is optional). So I now have a libsodium.lib and a libsodium.dll. Once I have a proof of concept that's working inside PyZMQ, I'll see if I can get this MSVC 2008 solution included upstream in libsodium. However, I'm not familiar with Python bundling process. How should I provide the libsodium headers, lib dll files to PyZMQ? What commands do you run to create the PyZMQ egg and whl bundles once I've made libsodium available to PyZMQ? Thanks, André On Fri, Oct 10, 2014 at 5:36 AM, Frank Hartmann sound...@gmx.net wrote: Hi, Tweetnacl linux integration has been added to libzmq some month ago. You could try compiling with tweetnacl and VS2008. One(only?) thing missing is randombytes() function on windows. Probably MS has a crypto API somewhere which should make this simple, if you trust them. And you can check how libsodium does it. regards Frank Min RK benjami...@gmail.com writes: For pyzmq, it must work with VC9 (VS2008), for Python 2.7. -MinRK On Oct 9, 2014, at 18:08, Steven McCoy steven.mc...@miru.hk wrote: I think it is easier now as they have more support than just MSVC2013 (C99 compat) when crypto was added to ZeroMQ. On 9 October 2014 17:47, MinRK benjami...@gmail.com wrote: It's not bundled simply because I couldn't build it on Windows. If you can come up with a simple fix for building bundled libsodium, then I would bundle libsodium on Windows. -MinRK On Thu, Oct 9, 2014 at 1:48 PM, André Caron andre.l.ca...@gmail.com wrote: Hi there! I'm trying to secure some PyZMQ communications with the curve security features. The code seems straightforward, but when I call `zmq.auth.create_certificates()` to generate some keys, I get the following exception: zmq.error.ZMQError: Not supported This seems to be due to the absence of libsodium. In the release notes for PyZMQ 14.1.0, I can see that libsodium is not bundled with PyZMQ on Windows. First,