[zeromq-dev] Unable to run Weather update server (wuserver.c) example

Shaukat Mahmood Ahmad write at sma.im
Mon Jun 17 18:35:55 CEST 2013


Yes it works, Thanks a lot for your help.
There were two mistakes one using  ipc:// yunder Windows and second I
was not very familiar with concepts of filters, My program (sever and
client) were running properly however I was unable to see any updates
due to filter mismatch. As Charles said I have removed the second call
to zmq_bind ( zmq_bind (publisher, "ipc://weather.ipc") which was
unnecessary. However this unnecessary line has craeted a lot of
trouble for me ( but there was also an opportunity to learn more ;) ),
and this needs to be corrected under documentation and sample examples
to avoid confusions of new comers.

On Mon, Jun 17, 2013 at 8:46 PM, Charles Remes <lists at chuckremes.com> wrote:
> The second bind in the original example (rc = zmq_bind (publisher, "ipc://weather.ipc");) is completely unnecessary because the client never connects to an ipc endpoint.
>
> Delete that line of code and try the example again.
>
> cr
>
> On Jun 17, 2013, at 10:41 AM, Shaukat Mahmood Ahmad <write at sma.im> wrote:
>
>> Dear Pieter,
>>
>> Regarding your suggestion I have a question regarding Weather Update
>> Server example (https://github.com/imatix/zguide/blob/master/examples/C/wuserver.c),
>> said example uses dual binding tcp and ipc is it neceesary for PubSub
>> style communication to have two bindings? And as per your suggestion
>> will I have to replace the second binding with tcp binding as per
>> following code snippet.
>>
>>
>> --- Original Code Snippet from Example
>>
>> void *context = zmq_ctx_new ();
>> void *publisher = zmq_socket (context, ZMQ_PUB);
>> int rc = zmq_bind (publisher, "tcp://*:5556");
>> assert (rc == 0);
>> rc = zmq_bind (publisher, "inproc://workers");
>> assert (rc == 0);
>>
>>
>> --- Revised code as per your suggestion (if i got it right)
>> void *context = zmq_ctx_new ();
>> void *publisher = zmq_socket (context, ZMQ_PUB);
>> int rc = zmq_bind (publisher, "tcp://*:5556");
>> assert (rc == 0);
>> rc = zmq_bind (publisher, "tcp://*.5557");
>> assert (rc == 0);
>>
>> ----------------------------------------
>>
>> I have tried this on my side Server and Client run successfully,
>> however no updates are collected by client, can you help me to resolve
>> this issue so that I can run PubDub example on my side.
>>
>>
>> On Mon, Jun 17, 2013 at 6:51 PM, Pieter Hintjens <ph at imatix.com> wrote:
>>> Shaukat,
>>>
>>> Sorry about this. I'd recommend changing the ipc:// endpoint to a
>>> tcp:// one (with valid endpoints). It will work just the same. The
>>> later examples all do this.
>>>
>>> -Pieter
>>>
>>> On Mon, Jun 17, 2013 at 3:10 PM, shancat <shannenlaptop at gmail.com> wrote:
>>>> Not that I know of but I haven't gone that deep into zmq on Windows. You
>>>> might be sacrificing performance but I don't think there's up to date
>>>> performance information on Windows. Maybe you can do some benchmarks? If go
>>>> to http://api.zeromq.org/3-2:zmq-bind and go to the part about transports
>>>> you can go to each inbuilt transport doc page and read up.
>>>>
>>>> On Jun 17, 2013 10:44 PM, "Shaukat Mahmood Ahmad" <write at sma.im> wrote:
>>>>
>>>> Thanks for being supportive, one last thing if I go with C/C++ on
>>>> Windows what else will I have  to sacrifice (other than ipc://)? Can
>>>> you guide me to a reference / contents / list of zeroMQ protocols /
>>>> transports with supported platforms.
>>>>
>>>> Regards,
>>>> SMA
>>>>
>>>> On Mon, Jun 17, 2013 at 5:34 AM, shancat <shannenlaptop at gmail.com> wrote:
>>>>> It depends what you're trying to do with it but yes I would use it on
>>>>> Windows myself. You might want to look at the C# binding
>>>>> (https://github.com/zeromq/clrzmq) or the native C# port
>>>>> (https://github.com/zeromq/netmq).
>>>>>
>>>>> On Jun 17, 2013 4:37 AM, "Shaukat Mahmood Ahmad" <write at sma.im> wrote:
>>>>>>
>>>>>> Thank shancat, yes finally I found it in API reference guide and in an
>>>>>> old thread (under zmq mailing list) where some one had requested and
>>>>>> tried to add ipc:// support for windows in 2011 but no success till
>>>>>> 2013. As a user can you recommend zMQ on windows as I was evaluating
>>>>>> it for a commercial software product currently running on Windows?
>>>>>>
>>>>>>
>>>>>> On Sun, Jun 16, 2013 at 8:22 PM, shancat <shannenlaptop at gmail.com> wrote:
>>>>>>> From the documentation: "The inter-process transport is currently only
>>>>>>> implemented on operating systems that provide UNIX domain sockets." So
>>>>>>> that's why bit doesn't work on Windows, failing with a helpful
>>>>>>> "Protocol
>>>>>>> not
>>>>>>> supported" message.
>>>>>>>
>>>>>>> On Jun 16, 2013 10:30 PM, "Shaukat Mahmood Ahmad" <write at sma.im> wrote:
>>>>>>>>
>>>>>>>> I am new to zeroMQ so sorry for incomplete information in my last
>>>>>>>> message in this thread, after debugging I have found that following
>>>>>>>> code is failing on Windows platform with error # 135 and message
>>>>>>>> against this error is "Protocol not supported", there is some
>>>>>>>> advancement but I am still confused  to get exact reason of failure
>>>>>>>> (as I am unable to locate some data in help / manual).
>>>>>>>>
>>>>>>>> Environment:
>>>>>>>> Windows 7 Professional 64bit
>>>>>>>> Visual Studio 2012
>>>>>>>> zeroMQ   version 3.2.3
>>>>>>>>
>>>>>>>> code snippet:
>>>>>>>>
>>>>>>>>    rc = zmq_bind (publisher, "ipc://weather.ipc"); // returns rc = -1
>>>>>>>>    err = zmq_errno();   // return err = 135
>>>>>>>>    errmsg = (char*) zmq_strerror(err); = returns error message string
>>>>>>>> as "Protocol not supported"
>>>>>>>>
>>>>>>>> Can anybody tell me about ipc protocol support on Windows platform.
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> End Note:
>>>>>>>> Now I am really  confused about statements made about zeroMQ such as
>>>>>>>> it will provide ease will reduce time to solve bigger problems, but
>>>>>>>> the way it is presented and documented is really useless, to use this
>>>>>>>> library either you  have extra time to debug the available source and
>>>>>>>> re-write to fit your need or simply find some other suitable library.
>>>>>>>>
>>>>>>>> 0/100  for zeroMQ because I have wasted my whole weekend on trying to
>>>>>>>> understand this useless library.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Jun 16, 2013 at 2:12 PM, Shaukat Mahmood Ahmad <write at sma.im>
>>>>>>>> wrote:
>>>>>>>>> Hi,
>>>>>>>>> I am unable to run Weather update server (wuserver.c) example due to
>>>>>>>>> failed assertion at second bind request as following.
>>>>>>>>>
>>>>>>>>> rc = zmq_bind (publisher, "ipc://weather.ipc");
>>>>>>>>> assert (rc == 0);
>>>>>>>>>
>>>>>>>>> The above assert fails as zmq_bind() returns -1.
>>>>>>>>>
>>>>>>>>> Can anybody help me to resolve this error.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> : Complete Code
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> #include "zhelpers.h"
>>>>>>>>>
>>>>>>>>> int main ()
>>>>>>>>> {
>>>>>>>>>    void *context = zmq_ctx_new();
>>>>>>>>>   void *publisher = zmq_socket(context, ZMQ_PUB);
>>>>>>>>>   int rc = zmq_bind(publisher, "tcp://*:5556");
>>>>>>>>>   assert (rc == 0);
>>>>>>>>>   rc = zmq_bind(publisher, "ipc://weather.ipc");
>>>>>>>>>   rc = zmq_bind (publisher, "ipc://weather.ipc");
>>>>>>>>>   assert (rc == 0);
>>>>>>>>>
>>>>>>>>>   srand ((unsigned) time(NULL));
>>>>>>>>>
>>>>>>>>>   while (1)
>>>>>>>>>   {
>>>>>>>>>      int zipcode, temperature, relhumidity;
>>>>>>>>>      char update[20];
>>>>>>>>>      zipcode = randof (100000);
>>>>>>>>>      temperature = randof (215) - 80;
>>>>>>>>>      relhumidity = randof (50) + 10;
>>>>>>>>>      sprintf (update, "%05d %d %d", zipcode, temperature,
>>>>>>>>> relhumidity);
>>>>>>>>>      s_send( publisher, update);
>>>>>>>>>   }
>>>>>>>>>   zmq_close (publisher);
>>>>>>>>>   zmq_ctx_destroy (context);
>>>>>>>>>   return 0;
>>>>>>>>> }
>>>>>>>> _______________________________________________
>>>>>>>> zeromq-dev mailing list
>>>>>>>> zeromq-dev at lists.zeromq.org
>>>>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> zeromq-dev mailing list
>>>>>>> zeromq-dev at lists.zeromq.org
>>>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>>>>
>>>>>> _______________________________________________
>>>>>> zeromq-dev mailing list
>>>>>> zeromq-dev at lists.zeromq.org
>>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> zeromq-dev mailing list
>>>>> zeromq-dev at lists.zeromq.org
>>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>>
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>
>>>>
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> 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