[zeromq-dev] Improvement(?) for binding and connecting sockets using single method

Pieter Hintjens ph at imatix.com
Wed May 14 10:08:40 CEST 2014


Hi Panu,

I've played with something similar for CZMQ, where I wanted a simple
socket constructor that would bind and/or connect a new socket
immediately.

My idea was to prefix the endpoint with '@' ("at") to mean bind, and
otherwise treat it as connect.

I didn't implement it because in many cases you must specify
additional socket options before binding or connecting.

One idea I had was to define socket "models" so you could configure a
model with all the necessary options, then use it at construction
time.

-Pieter





On Wed, May 14, 2014 at 9:32 AM, Panu Wetterstrand
<panu.wetterstrand at iki.fi> wrote:
> Hello,
>
> we have lots of small ZeroMQ devices written in Java. Mostly we need to
> specify how socket connect to others as command line parameter. Because
> there is two different methods connect and bind this is not straight
> forward. First we have to parse if we should bind or connect and then call
> the correct method.
>
> To ease this we have written parser that accepts urls like this:
>
>     connect:tcp://localhost:1234
>     bind:tcp://*:5555:123;connect:ipc:/tmp/blaah
>
> Thus the idea is that one can spesify connection or bind before the actual
> zeromq url. Also multiple urls can be definer by separating them using
> ;-character.
>
> (Java library can be found here
> https://bitbucket.org/jyukopla/java-zmq-utils)
>
> My question is:
> Would it make any sense implement method to ZeroMQ library that would do the
> same thing? Signature would be something like this:
>
>     int zmq_associate (void *socket, const char *urlstring);
>
>
> --
> Panu
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list