The main README.md in the root should be enough to get started, it has a
quick example section for zsock (and all other classes). Else the
zsock_test selftest method is another good example.

In general it's pretty easy, something like:

zsock_t *a = zsock_new_pair("@inproc://foo");
zsock_t *b = zsock_new_pair(">inproc://foo");
zsock_send(a, "p", ptr0);
zsock_recv(b, "p", &ptr1);
zsock_destroy(&a);
zsock_destroy(&b);

On Wed, 2016-12-21 at 00:12 +0100, Shrikanth M.D. wrote:
> Hello,
> 
> Is there any comprehensive guide/tutorial/book to follow czmq?
> Apparently there have been so many evolutions and it is difficult to follow.
> For instance, zsocket is not available on the latest and no idea how to use
> zsock classes.
> 
> Please help.
> 
> Rgerads,
> Shrikanth
> 
> On Tue, Dec 20, 2016 at 2:10 PM, Luca Boccassi <luca.bocca...@gmail.com>
> wrote:
> 
> > On Tue, 2016-12-20 at 13:14 +0100, Shrikanth M.D. wrote:
> > > Hi,
> > >
> > > I have tried a small piece of code as in here:
> > > http://pastebin.com/JUxXjYX2
> > >
> > >
> > > I am using ZEROMQ 4.1.5 library and running on Ubuntu 15.04.
> > > This is how I compile and execute the code:
> > >  gcc zeromq_example.c -o a.out -lzmq -lpthread
> > >
> > >
> > >
> > > When I compile the example code in the link as sudo user, I am able to
> > > successfully receive
> > > the struct content on the thread side.
> > > However, occasionally I observe ZMQ_Receive  error. Is this because I am
> > > executing my program too quickly again in the second run?
> > >
> > > Below is the output:
> > > shrikanth@mds:~$ sudo ./a.out
> > > The values received are 1000 5000 100 500 HelloWorld
> > > shrikanth@mds:~$ sudo ./a.out
> > > Error in Receiving
> > > The values received are -1052453120 32596 1 0
> > > shrikanth@mds:~$ sudo ./a.out
> > > The values received are 1000 5000 100 500 HelloWorld
> > > shrikanth@mds:~$
> > >
> > >
> > > Also, without sudo user, although buffer contents are received by the
> > > thread, it ends up with a segmentation fault (may be because of the
> > memory
> > > access to struct sample within the struct example).
> > >
> > > Could you please suggest a workaround for this situation?
> > > I do not want to serialize/de-serialize stuff between my main thread and
> > > worker thread.
> > >
> > > Any kind of input is deeply appreciated.
> > >
> > > Regards,
> > > Shrikanth
> >
> > What you are trying to do is already implemented in CZMQ, so I would
> > recommend you to use that instead:
> >
> > https://github.com/zeromq/czmq
> >
> > zsock_send ("p", pointer)
> > zsock_recv ("p", &pointer)
> >
> > Kind regards,
> > Luca Boccassi
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev@lists.zeromq.org
> > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to