Like us on Facebook!

Tuesday, 9 April 2013

ØMQ - 1 server and 3 client message processing

So after reading the documentation carefully I was able to figure out which constants to use for my little project.

For the server I need to use ZMQ_PULL. Here the socket collects messages from clients evenly using fair-queuing.

On the client side I am using ZMQ_PUSH. Each client will push a message to the server on the same port that the server listens on.


So here it is in action …

now what's left is to tidy up the code :)


Top left is the server and the rest are clients that are sending messages with time() to differentiate individual messages.



Server Code



Client Code



3 comments:

  1. here is the netstat info...

    root@ubuntu:/home/smq# netstat -anp | grep 555
    tcp 0 0 0.0.0.0:5558 0.0.0.0:* LISTEN 9306/perl
    tcp 0 0 127.0.0.1:38623 127.0.0.1:5558 ESTABLISHED 9313/perl
    tcp 0 0 127.0.0.1:38626 127.0.0.1:5558 ESTABLISHED 9334/perl
    tcp 0 0 127.0.0.1:5558 127.0.0.1:38624 ESTABLISHED 9306/perl
    tcp 0 0 127.0.0.1:5558 127.0.0.1:38623 ESTABLISHED 9306/perl
    tcp 0 0 127.0.0.1:38624 127.0.0.1:5558 ESTABLISHED 9320/perl
    tcp 0 0 127.0.0.1:5558 127.0.0.1:38626 ESTABLISHED 9306/perl

    ReplyDelete
  2. Do you mind if I quote a few of your articles
    as long as I provide credit and sources back to your webpage?
    My website is in the very same niche as yours and my users would certainly benefit from a lot of
    the information you provide here. Please let me know if this okay
    with you. Thanks a lot!

    Also visit my website protect ebook

    ReplyDelete
    Replies
    1. Not at all :)

      Feel free to share/add/correct....

      this blog just came online so we are in the baby stage of adding content and finding ways to engage users.

      Delete

Have your say!