Re: [zeromq-dev] ZeroMQ and NORM

2015-03-11 Thread MinRK
How did you install pyzmq? What OS is this?

-MinRK

On Wed, Mar 11, 2015 at 7:03 AM, Adam Najman naj...@gmail.com wrote:

 I'm trying to establish a NORM connection using ZeroMQ as detailed here:

 http://zeromq.org/topics:norm-protocol-transport

 I've already built NORM and ZeroMQ with support for norm using ./configure
 –with-norm=/path/to/norm.

 The code I'm trying is as follows:

 #Subscriberimport zmq
 context = zmq.Context()
 socket = context.socket(zmq.SUB)
 socket.bind(norm://224.1.2.3:5556)
 socket.setsockopt(zmq.SUBSCRIBE, ZMQ-Test)while True:
 string = socket.recv()
 print string
 #Publisherimport zmqimport time
 context = zmq.Context()
 socket = context.socket(zmq.PUB)
 socket.connect(norm://224.1.2.3:5556)
 i = 1while True:
 topic = ZMQ-Test
 message = Hello, NORM  + str(i) +  …
 socket.send(%s %s % (topic, message))
 i += 1
 time.sleep(1)

 Whenever I run either of these, I get an error message:

 Traceback (most recent call last):
   File pub.py, line 5, in module
 socket.connect(norm://224.1.2.3:5556)
   File zmq/backend/cython/socket.pyx, line 471, in 
 zmq.backend.cython.socket.Socket.connect (zmq/backend/cython/socket.c:4295)
 zmq.error.ZMQError: Protocol not supported

 I've tried re-installing everything and building everything from scratch,
 including NORM ZeroMQ and PyZMQ. Can anyone help with this issue? Python
 Version: 2.7.9 NORM Version: 1.5b4 ZeroMQ Version: 3.2.5

 ___
 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] ZeroMQ and NORM

2015-03-11 Thread MinRK
If you want to configure zeromq, you probably shouldn’t be using
--zmq=bundled. I would configure and install libzmq with --prefix=PREFIX,
then load it for pyzmq with setup.py install --zmq=PREFIX.

-MinRK
​

On Wed, Mar 11, 2015 at 11:37 AM, Michel Pelletier 
pelletier.mic...@gmail.com wrote:

 I guess my approach doesn't help if you're looking to add special
 configure args like --with-norm, MinRK, do you know of a way to pass those
 args to the bundling configure call?  A quick glance at setup.py didn't
 give me any good ideas.

 -Michel

 On Wed, Mar 11, 2015 at 10:40 AM, Michel Pelletier 
 pelletier.mic...@gmail.com wrote:

 I've found the best way to avoid these kind of problems (version mismatch
 with existing system libzmq) is to use a virtual environment and then do a
 bundled pyzmq build:

   $ virtualenv foo
   $ . foo/bin/activate
   (foo)$  pip install --install-option --zmq=bundled pyzmq
   (foo)$ python -c 'import zmq; print zmq.zmq_version()'
   4.0.5

 It always makes a nice, isolated install.

 -Michel

 On Wed, Mar 11, 2015 at 10:29 AM, Brian Adamson 
 brian.adam...@nrl.navy.mil wrote:

 As I think MinRF is getting at here, you need to make sure your pyzmq
 you are using is loading the libzmq that you built/installed with the NORM
 extension.  On my systems, I had to download and install pyzmq from source
 code instead of one the prebuilt packages that assumed a dependency on an
 existing libzmq package instead of what you are building yourself.  In a
 nutshell, I built (with norm) and installed the github libzmq and then
 separately downloaded pyzmq and used its “python setup.py install” approach
 to install it from source.  I also had to make sure I didn’t have pyzmq
 installed some other way since you can end up with other packages on your
 systems that want to install pyzmq in a standard way since they have their
 own dependencies upon it.

 Note the current GitHub libzmq is 4.2.0.  If your system is reporting
 version 3.2.5, it’s likely you have a conflicting (without norm and hence
 the error) version of libzmq installed that pyzmq is finding instead of the
 one you want.

 best regards,

 Brian



 On Mar 11, 2015, at 12:54 PM, MinRK benjami...@gmail.com wrote:

 How did you install pyzmq? What OS is this?

 -MinRK

 On Wed, Mar 11, 2015 at 7:03 AM, Adam Najman naj...@gmail.com wrote:

 I'm trying to establish a NORM connection using ZeroMQ as detailed here:

 http://zeromq.org/topics:norm-protocol-transport

 I've already built NORM and ZeroMQ with support for norm using
 ./configure –with-norm=/path/to/norm.

 The code I'm trying is as follows:

 #Subscriberimport zmq
 context = zmq.Context()
 socket = context.socket(zmq.SUB)
 socket.bind(norm://224.1.2.3:5556)
 socket.setsockopt(zmq.SUBSCRIBE, ZMQ-Test)while True:
 string = socket.recv()
 print string
 #Publisherimport zmqimport time
 context = zmq.Context()
 socket = context.socket(zmq.PUB)
 socket.connect(norm://224.1.2.3:5556)
 i = 1while True:
 topic = ZMQ-Test
 message = Hello, NORM  + str(i) +  …
 socket.send(%s %s % (topic, message))
 i += 1
 time.sleep(1)

 Whenever I run either of these, I get an error message:

 Traceback (most recent call last):
   File pub.py, line 5, in module
 socket.connect(norm://224.1.2.3:5556)
   File zmq/backend/cython/socket.pyx, line 471, in 
 zmq.backend.cython.socket.Socket.connect (zmq/backend/cython/socket.c:4295)
 zmq.error.ZMQError: Protocol not supported

 I've tried re-installing everything and building everything from
 scratch, including NORM ZeroMQ and PyZMQ. Can anyone help with this issue?
 Python Version: 2.7.9 NORM Version: 1.5b4 ZeroMQ Version: 3.2.5

 ___
 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] ZeroMQ and NORM

2015-03-11 Thread Michel Pelletier
I guess my approach doesn't help if you're looking to add special configure
args like --with-norm, MinRK, do you know of a way to pass those args to
the bundling configure call?  A quick glance at setup.py didn't give me any
good ideas.

-Michel

On Wed, Mar 11, 2015 at 10:40 AM, Michel Pelletier 
pelletier.mic...@gmail.com wrote:

 I've found the best way to avoid these kind of problems (version mismatch
 with existing system libzmq) is to use a virtual environment and then do a
 bundled pyzmq build:

   $ virtualenv foo
   $ . foo/bin/activate
   (foo)$  pip install --install-option --zmq=bundled pyzmq
   (foo)$ python -c 'import zmq; print zmq.zmq_version()'
   4.0.5

 It always makes a nice, isolated install.

 -Michel

 On Wed, Mar 11, 2015 at 10:29 AM, Brian Adamson 
 brian.adam...@nrl.navy.mil wrote:

 As I think MinRF is getting at here, you need to make sure your pyzmq you
 are using is loading the libzmq that you built/installed with the NORM
 extension.  On my systems, I had to download and install pyzmq from source
 code instead of one the prebuilt packages that assumed a dependency on an
 existing libzmq package instead of what you are building yourself.  In a
 nutshell, I built (with norm) and installed the github libzmq and then
 separately downloaded pyzmq and used its “python setup.py install” approach
 to install it from source.  I also had to make sure I didn’t have pyzmq
 installed some other way since you can end up with other packages on your
 systems that want to install pyzmq in a standard way since they have their
 own dependencies upon it.

 Note the current GitHub libzmq is 4.2.0.  If your system is reporting
 version 3.2.5, it’s likely you have a conflicting (without norm and hence
 the error) version of libzmq installed that pyzmq is finding instead of the
 one you want.

 best regards,

 Brian



 On Mar 11, 2015, at 12:54 PM, MinRK benjami...@gmail.com wrote:

 How did you install pyzmq? What OS is this?

 -MinRK

 On Wed, Mar 11, 2015 at 7:03 AM, Adam Najman naj...@gmail.com wrote:

 I'm trying to establish a NORM connection using ZeroMQ as detailed here:

 http://zeromq.org/topics:norm-protocol-transport

 I've already built NORM and ZeroMQ with support for norm using
 ./configure –with-norm=/path/to/norm.

 The code I'm trying is as follows:

 #Subscriberimport zmq
 context = zmq.Context()
 socket = context.socket(zmq.SUB)
 socket.bind(norm://224.1.2.3:5556)
 socket.setsockopt(zmq.SUBSCRIBE, ZMQ-Test)while True:
 string = socket.recv()
 print string
 #Publisherimport zmqimport time
 context = zmq.Context()
 socket = context.socket(zmq.PUB)
 socket.connect(norm://224.1.2.3:5556)
 i = 1while True:
 topic = ZMQ-Test
 message = Hello, NORM  + str(i) +  …
 socket.send(%s %s % (topic, message))
 i += 1
 time.sleep(1)

 Whenever I run either of these, I get an error message:

 Traceback (most recent call last):
   File pub.py, line 5, in module
 socket.connect(norm://224.1.2.3:5556)
   File zmq/backend/cython/socket.pyx, line 471, in 
 zmq.backend.cython.socket.Socket.connect (zmq/backend/cython/socket.c:4295)
 zmq.error.ZMQError: Protocol not supported

 I've tried re-installing everything and building everything from
 scratch, including NORM ZeroMQ and PyZMQ. Can anyone help with this issue?
 Python Version: 2.7.9 NORM Version: 1.5b4 ZeroMQ Version: 3.2.5

 ___
 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] ZeroMQ and NORM

2015-03-11 Thread Brian Adamson
As I think MinRF is getting at here, you need to make sure your pyzmq you are 
using is loading the libzmq that you built/installed with the NORM extension.  
On my systems, I had to download and install pyzmq from source code instead of 
one the prebuilt packages that assumed a dependency on an existing libzmq 
package instead of what you are building yourself.  In a nutshell, I built 
(with norm) and installed the github libzmq and then separately downloaded 
pyzmq and used its “python setup.py install” approach to install it from 
source.  I also had to make sure I didn’t have pyzmq installed some other way 
since you can end up with other packages on your systems that want to install 
pyzmq in a standard way since they have their own dependencies upon it.

Note the current GitHub libzmq is 4.2.0.  If your system is reporting version 
3.2.5, it’s likely you have a conflicting (without norm and hence the error) 
version of libzmq installed that pyzmq is finding instead of the one you want.

best regards,

Brian


 On Mar 11, 2015, at 12:54 PM, MinRK benjami...@gmail.com wrote:
 
 How did you install pyzmq? What OS is this?
 
 -MinRK
 
 On Wed, Mar 11, 2015 at 7:03 AM, Adam Najman naj...@gmail.com 
 mailto:naj...@gmail.com wrote:
 I'm trying to establish a NORM connection using ZeroMQ as detailed here:
 
 http://zeromq.org/topics:norm-protocol-transport 
 http://zeromq.org/topics:norm-protocol-transport
 I've already built NORM and ZeroMQ with support for norm using ./configure 
 –with-norm=/path/to/norm.
 
 The code I'm trying is as follows:
 
 #Subscriber
 import zmq
 context = zmq.Context()
 socket = context.socket(zmq.SUB)
 socket.bind(norm://224.1.2.3:5556 http://224.1.2.3:5556/)
 socket.setsockopt(zmq.SUBSCRIBE, ZMQ-Test)
 while True:
 string = socket.recv()
 print string
 
 #Publisher
 import zmq
 import time
 context = zmq.Context()
 socket = context.socket(zmq.PUB)
 socket.connect(norm://224.1.2.3:5556 http://224.1.2.3:5556/)
 i = 1
 while True:
 topic = ZMQ-Test
 message = Hello, NORM  + str(i) +  …
 socket.send(%s %s % (topic, message))
 i += 1
 time.sleep(1)
 Whenever I run either of these, I get an error message:
 
 Traceback (most recent call last):
   File pub.py, line 5, in module
 socket.connect(norm://224.1.2.3:5556 http://224.1.2.3:5556/)
   File zmq/backend/cython/socket.pyx, line 471, in 
 zmq.backend.cython.socket.Socket.connect (zmq/backend/cython/socket.c:4295)
 zmq.error.ZMQError: Protocol not supported
 I've tried re-installing everything and building everything from scratch, 
 including NORM ZeroMQ and PyZMQ. Can anyone help with this issue? Python 
 Version: 2.7.9 NORM Version: 1.5b4 ZeroMQ Version: 3.2.5
 
 
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org mailto:zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev 
 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] ZeroMQ and NORM

2015-03-11 Thread Michel Pelletier
I've found the best way to avoid these kind of problems (version mismatch
with existing system libzmq) is to use a virtual environment and then do a
bundled pyzmq build:

  $ virtualenv foo
  $ . foo/bin/activate
  (foo)$  pip install --install-option --zmq=bundled pyzmq
  (foo)$ python -c 'import zmq; print zmq.zmq_version()'
  4.0.5

It always makes a nice, isolated install.

-Michel

On Wed, Mar 11, 2015 at 10:29 AM, Brian Adamson brian.adam...@nrl.navy.mil
wrote:

 As I think MinRF is getting at here, you need to make sure your pyzmq you
 are using is loading the libzmq that you built/installed with the NORM
 extension.  On my systems, I had to download and install pyzmq from source
 code instead of one the prebuilt packages that assumed a dependency on an
 existing libzmq package instead of what you are building yourself.  In a
 nutshell, I built (with norm) and installed the github libzmq and then
 separately downloaded pyzmq and used its “python setup.py install” approach
 to install it from source.  I also had to make sure I didn’t have pyzmq
 installed some other way since you can end up with other packages on your
 systems that want to install pyzmq in a standard way since they have their
 own dependencies upon it.

 Note the current GitHub libzmq is 4.2.0.  If your system is reporting
 version 3.2.5, it’s likely you have a conflicting (without norm and hence
 the error) version of libzmq installed that pyzmq is finding instead of the
 one you want.

 best regards,

 Brian



 On Mar 11, 2015, at 12:54 PM, MinRK benjami...@gmail.com wrote:

 How did you install pyzmq? What OS is this?

 -MinRK

 On Wed, Mar 11, 2015 at 7:03 AM, Adam Najman naj...@gmail.com wrote:

 I'm trying to establish a NORM connection using ZeroMQ as detailed here:

 http://zeromq.org/topics:norm-protocol-transport

 I've already built NORM and ZeroMQ with support for norm using
 ./configure –with-norm=/path/to/norm.

 The code I'm trying is as follows:

 #Subscriberimport zmq
 context = zmq.Context()
 socket = context.socket(zmq.SUB)
 socket.bind(norm://224.1.2.3:5556)
 socket.setsockopt(zmq.SUBSCRIBE, ZMQ-Test)while True:
 string = socket.recv()
 print string
 #Publisherimport zmqimport time
 context = zmq.Context()
 socket = context.socket(zmq.PUB)
 socket.connect(norm://224.1.2.3:5556)
 i = 1while True:
 topic = ZMQ-Test
 message = Hello, NORM  + str(i) +  …
 socket.send(%s %s % (topic, message))
 i += 1
 time.sleep(1)

 Whenever I run either of these, I get an error message:

 Traceback (most recent call last):
   File pub.py, line 5, in module
 socket.connect(norm://224.1.2.3:5556)
   File zmq/backend/cython/socket.pyx, line 471, in 
 zmq.backend.cython.socket.Socket.connect (zmq/backend/cython/socket.c:4295)
 zmq.error.ZMQError: Protocol not supported

 I've tried re-installing everything and building everything from scratch,
 including NORM ZeroMQ and PyZMQ. Can anyone help with this issue? Python
 Version: 2.7.9 NORM Version: 1.5b4 ZeroMQ Version: 3.2.5

 ___
 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] CURVE I: cannot open client INITIATE vouch

2015-03-11 Thread Bachmair Florian - flexSolution GmbH
Hi!

I have generated the certificates with 'makecert' and put it in individual 
.curve folders for the subscriber and publisher.
If I let the publisher use the private certificate and the subscriber the 
public one I get this output : CURVE I: cannot open client INITIATE vouch

But if I use private key on publisher AND subscriber side it works, but that's 
not the way it should be?!

subscriber.c
#include czmq.h

static char * s_recv(void *socket);

int main(int argc, char **argv) {
puts(Subscriber);
zctx_t* context = zctx_new();

void* subscriber = zsocket_new(context, ZMQ_SUB);

zcert_t *client_cert = zcert_load(.curve/mycert.pub);
char* server_key = zcert_public_txt(client_cert);
puts(server_key);
assert(client_cert);
zcert_apply(client_cert, subscriber);
zsocket_set_curve_serverkey(subscriber, server_key);
zsocket_connect(subscriber, tcp://127.0.0.1:5);

zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, B, 1);
while (1) {
   // Read envelope with address
   char *address = s_recv(subscriber);
   // Read message contents
   char *contents = s_recv(subscriber);
   printf([%s] %s\n, address, contents);
   free(address);
   free(contents);
}
// We never get here, but clean up anyhow
zmq_close(subscriber);
zmq_ctx_destroy(context);
return 0;
}

static char * s_recv(void *socket) {
char buffer[256];
int size = zmq_recv(socket, buffer, 255, 0);
if (size == -1)
   return NULL;
if (size  255)
   size = 255;
buffer[size] = 0;
return strdup(buffer);
}
##
publisher.c
#include czmq.h
static int s_send(void *socket, char *string);
static int s_sendmore(void *socket, char *string);

int main(void) {
puts(Publisher);
int major, minor, patch;
zmq_version(major, minor, patch);
printf(Current ØMQ version is %d.%d.%d\n, major, minor, 
patch);
zctx_t *context = zctx_new();
zauth_t *auth = zauth_new(context);
zauth_allow(auth, 127.0.0.1);
assert(auth);
zauth_set_verbose(auth, true);
zauth_configure_curve(auth, *, .curve);

zcert_t *server_cert = zcert_load(.curve/mycert.pvt);
assert(server_cert);
void *publisher = zsocket_new(context, ZMQ_PUB);
zcert_apply(server_cert, publisher);
zsocket_set_curve_server(publisher, 1);
int rc = zsocket_bind(publisher, tcp://*:5);
assert (rc != -1);
while (1) {
   s_sendmore(publisher, A);
   s_send(publisher, We don't want to see this);
   s_sendmore(publisher, B);
   s_send(publisher, We would like to see this);
   sleep(1);
}
zmq_close(publisher);
zmq_ctx_destroy(context);
puts(exit);
return 0;
}
// Convert C string to 0MQ string and send to socket
static int s_send(void *socket, char *string) {
int size = zmq_send(socket, string, strlen(string), 0);
return size;
}
// Sends string as 0MQ string, as multipart non-terminal
static int s_sendmore(void *socket, char *string) {
int size = zmq_send(socket, string, strlen(string), 
ZMQ_SNDMORE);
return size;
}


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Newbie question about how zmq actually works

2015-03-11 Thread YANG Fan
Wow this is so neat! I don't need to open a background thread for receiving
at all!

Thanks so much!

On Wed, Mar 11, 2015 at 10:52 AM, Kenneth Adam Miller 
kennethadammil...@gmail.com wrote:

 Oh whoops, wrong link. Here, read this:

 http://zeromq.org/whitepapers:architecture

 On Tue, Mar 10, 2015 at 10:45 PM, Kenneth Adam Miller 
 kennethadammil...@gmail.com wrote:

 I'm pretty sure that's exactly what happens. ZMQ handles all of the
 buffering in the background so your application can look clean and good.

 Check out this question, fielded by Pieter himself:


 http://stackoverflow.com/questions/10528659/what-is-the-rationale-behind-zeromq-context


 On Tue, Mar 10, 2015 at 10:31 PM, Fan Yang idd...@gmail.com wrote:

 Hi,

 I'm not sure about how zmq works asynchronously. Assume that I have two
 peers A and B. A has a PUSH socket and B has PULL. Then A connects to B.

 What if A send some messages to B but B hasn't invoked recv() yet? Will
 the messages be first received by the zmq IO thread, and then presented
 when B starts to recv()?

 Best Regards,
 Fan

 ___
 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]: Asynchronous client api design

2015-03-11 Thread Yassine Lamgarchal
2015-03-11 1:30 GMT+01:00 Kenneth Adam Miller kennethadammil...@gmail.com:

 Ok, well when you have some code let me know and I will review.


Cool :), here is the repo of the project
https://github.com/ylamgarchal/chillaxd

For now, the client is synchronous, i'll will update it.
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[zeromq-dev] zmq_poll question.

2015-03-11 Thread Riskybiz
If I an application uses zmq_poll() before sending or receiving messages to
check socket(s) for these events;

 

ZMQ_POLLIN

For ØMQ sockets, at least one message may be received from the socket
without blocking. For standard sockets this is equivalent to the POLLIN flag
of the poll()system call and generally means that at least one byte of data
may be read fromfd without blocking.

ZMQ_POLLOUT

For ØMQ sockets, at least one message may be sent to the socket without
blocking. For standard sockets this is equivalent to the POLLOUT flag of the
poll()system call and generally means that at least one byte of data may be
written tofd without blocking.

Does it imply that a check has been made which will ensure that the HWM
(high water mark) of a sending or receiving socket will not be exceeded?

 

So that for example;

Consider a DEALER-ROUTER connection where the ZMQ_ROUTER has reached a mute
state and is dropping messages.  Is it the case that by checking for
ZMQ_POLLOUT on the ZMQ_DEALER before sending to the ZMQ_ROUTER that it would
prevent a message from being sent and consequently dropped by the
ZMQ_ROUTER.

 

  Additionally the ZMQ_ROUTER could be set up using zmq_poll() to check for
ZMQ_POLLIN  ZMQ_POLLOUT which would prevent exceeding its HWM by not
accepting further inbound messages when in the mute state; so that whilst
the socket may be full to the HWM it will not drop any messages?

 

 

When considering the zeromq api entry for zmq_poll()
http://api.zeromq.org/4-1:zmq-poll  I see that;

ZMQ_POLLIN For ØMQ sockets, at least one message may be received from the
socket without blocking.

ZMQ_POLLOUT For ØMQ sockets, at least one message may be sent to the socket
without blocking.

 

May I ask, how does this relate to multi-part messages?  Is it that a single
zmq_msg_t message frame could be sent or received? Would an single entire
multi-part message be OK?  I intend to be using the ‘clone’ pattern and it
could be the case that a single very large multi-part message carrying the
‘state’ could be the next to be sent.

 

I would like to minimise the possibility that my code could cause messages
to get dropped by considering the implications of acting to send  receive
only on satisfactory poll events?

 

Any elaboration on these subjects is much appreciated.

 

With thanks,

 

Riskybiz.

 

 

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] zmq_poll question.

2015-03-11 Thread Kenneth Adam Miller
I have replied inline.

On Wed, Mar 11, 2015 at 8:09 AM, Riskybiz riskybizl...@live.com wrote:

 If I an application uses zmq_poll() before sending or receiving messages
 to check socket(s) for these events;



 *ZMQ_POLLIN*

 For ØMQ sockets, at least one message may be received from the *socket* 
 without
 blocking. For standard sockets this is equivalent to the *POLLIN* flag of
 the *poll()*system call and generally means that at least one byte of
 data may be read from*fd* without blocking.

 *ZMQ_POLLOUT*

 For ØMQ sockets, at least one message may be sent to the *socket* without
 blocking. For standard sockets this is equivalent to the *POLLOUT* flag
 of the *poll()*system call and generally means that at least one byte of
 data may be written to*fd* without blocking.

 Does it imply that a check has been made which will ensure that the HWM
 (high water mark) of a sending or receiving socket will not be exceeded?


How does a check ensure what will or not happen? Neither of the quoted
documentation segments reference high water marks. Just to be clear here,
the HWM is supposed to represent a threshhold limit that, when surpassed
implies message loss. Nothing says the HWM won't be exceeded, and no system
should try to guarantee that because they can't; when a recipient is sent
more messages than can be received, some will be lost, and this is why
there reliability mechanisms in place in the IoT at large. When things fail
in the internet, messages are lost.




 So that for example;

 Consider a DEALER-ROUTER connection where the ZMQ_ROUTER has reached a
 mute state and is dropping messages.  Is it the case that by checking for
 ZMQ_POLLOUT on the ZMQ_DEALER before sending to the ZMQ_ROUTER that it
 would prevent a message from being sent and consequently dropped by the
 ZMQ_ROUTER.



   Additionally the ZMQ_ROUTER could be set up using zmq_poll() to check
 for ZMQ_POLLIN  ZMQ_POLLOUT which would prevent exceeding its HWM by not
 accepting further inbound messages when in the mute state; so that whilst
 the socket may be full to the HWM it will not drop any messages?


The high water mark is not a solution to message loss; it is just a toggle
switch after you've reigned in the bad stuff *algorithmically* that you can
play with to either make your applications more efficient or more reliable,
and it allows you to tune ZMQ to your needs. In sum, I think that you're
doing a lot of thinking about HWM business that doesn't actually solve the
underlying problem at hand. Instead of HWM, doing an application message
loss failback mechanism and late message redundancy check might go hand in
hand to resolve whatever underlying issue you have by providing the
reliability that you want.






 When considering the zeromq api entry for zmq_poll()
 http://api.zeromq.org/4-1:zmq-poll I see that;

 *ZMQ_POLLIN *For ØMQ sockets, at least one message may be received from
 the *socket* without blocking.

 *ZMQ_POLLOUT *For ØMQ sockets, at least one message may be sent to the
 *socket* without blocking.



 May I ask, how does this relate to multi-part messages?  Is it that a
 single zmq_msg_t message frame could be sent or received? Would an single
 entire multi-part message be OK?  I intend to be using the ‘clone’ pattern
 and it could be the case that a single very large multi-part message
 carrying the ‘state’ could be the next to be sent.


I'm not sure I have the expertise to answer this question, but I think that
my previous answers may or may not spurn some rethinking of how to approach
things.




 I would like to minimise the possibility that my code could cause messages
 to get dropped by considering the implications of acting to send  receive
 only on satisfactory poll events?


This is not a question and I therefore do not know how to respond. Please
read what I wrote above.




 Any elaboration on these subjects is much appreciated.



 With thanks,



 Riskybiz.





 ___
 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