Sunday September 4, 2011

[Time] NameMessage
[00:05] errordeveloper hi
[00:05] errordeveloper I would like to hear an opinion on this
[00:05] errordeveloper interesting article btw
[00:23] mikko errordeveloper: opinion on what?
[00:44] errordeveloper well they are critisizing AMQP in general ...
[00:45] errordeveloper I wonder whether it really is so bad ?
[01:01] mikko i don't understand AMQP well enough to answer that really
[01:37] strich Afternoon
[01:39] strich Quick question - I need to get the uuid out of a message, store it, and pass it back when I form a reply. Its not working, and I think its because I'm probably serializing it to char or string, and then back again in a bad format. Any tips/guides on how to do this in C++?
[01:39] strich That is, the reply sends out, and the client doesn't get it. So I can only assume the uuid I'm replying to is wrong
[01:40] strich I'm using ROUTER (server) and DEALER (client)
[01:41] errordeveloper mikko: nevermind, I was mislead
[01:41] errordeveloper someone told me that zmq is an implementation of amqp
[01:41] errordeveloper and it's not :)
[01:42] errordeveloper hm ... so there is no xml involved in zmq, right?
[01:43] strich errordeveloper - As far as I know, no. But, you could still compose and serialize a XML structure into the zmq messages if you wanted to
[01:43] strich The way I see it, zmq is your mail postage company. XML or google's protobuf or any number of other message structures are the contents of the letter itself.
[01:46] errordeveloper sure
[01:46] errordeveloper i'm all for zmq now :)
[01:47] strich Aye i'm fairly new to it as well, but I'm loving it thus far
[01:47] strich Even if the C++ part of it isn't that well done
[01:47] errordeveloper though ... what about if my messages are time-sensetive ... i.e. they have to arrive in the same order ...
[01:48] errordeveloper ??
[01:48] strich zmq takes care of that for you
[01:48] errordeveloper kewl!!!
[01:48] errordeveloper :)))
[01:48] strich All you do as the developer is send the stuff and they'll arrive
[01:49] errordeveloper I mean, I would like to use it for networked music perfomrance applications
[01:50] strich music performance?
[01:50] strich Like a concert?
[01:51] strich You could stream music to subscribers using the PUBLISHER -> SUBSCRIBER concept, which multicasts out data (music) to clients
[02:07] mikko strich: how are you serialising to char * ?
[02:08] strich I've just rewritten my receive method, and it is currently untested with:
[02:08] strich uuid.assign(static_cast<char*>(;
[02:08] strich uuid is a std::string
[02:09] mikko i think you need to give size as well
[02:09] mikko otherwise it will cut on first null char
[02:09] strich You are correct. I didn't know if that would be ok or not
[02:09] mikko std::string uuid (static_cast<char*>(, zmsg.size());
[02:10] strich Yep just added that. I think you just saved me some debugging Fun mikko, cheers :)
[02:11] mikko another option is to use std::vector<unsigned char>
[02:11] strich Any reason to, specifically?
[02:11] strich My next question will be how I would drop my uuid string back into a reply. It seems most examples use memcpy
[02:12] mikko it will work as expected as a string but conceptually when it's a vector you dont mishandle it as a string
[02:12] mikko and expect .c_str() to be normal null terminated character array
[02:12] mikko zmq::message_t reply(uuid.size()); memcpy (...
[02:13] strich btw, do you have to supply .size for any message initialization? It seems theres a constructor that allows you to omit it
[02:14] mikko yes, if you copy data to it
[02:14] mikko the overloaded constructor with size will allocate storage for the message
[02:14] mikko zmq::message_t msg; can be used when receiving
[02:14] mikko where the engine calls init
[02:14] strich ok np, I think I'm fucking it up there to. I'll rewrite my send method
[02:15] mikko when you memcpy there has to be storage where to copy to
[02:18] strich zmq::message_t zmsg(uuid.size()); memcpy(,, uuid.size());
[02:26] strich zmq::message_t zmsg(uuid.size()); memcpy(, uuid.c_str(), uuid.size());
[02:26] strich mikko - Which should I use of the above?
[02:27] mikko i tend to use .c_str()
[02:27] mikko just out of habbit
[02:27] mikko i don't think there should be difference
[02:28] strich ok np
[02:29] mikko what is the issue?
[02:30] strich Oh nothing, still just refactoring my methods. I just saw it in two examples and wanted to know if there was a diff
[06:40] Nitin Hello everyone.. I have a question... I need to make a REST call to amazon web services.. Can I use zmq for that??..
[07:03] strich mmm I don't think so Nitin
[07:04] strich zmq requires zmq at both end-points
[07:04] strich You'll need to write an interface between Amazon's API and an internal zmq network of your own
[07:21] Nitin hmmm... ok.. so making a basic HTTP request is also not possible...
[07:54] sustrik there's raw TCP under 0MQ, not HTTP
[07:54] strich Even so, you wouldn't be able to communicate with a TCP socket unless its also under the control of zmq
[08:28] CIA-32 libzmq: 03Mikko Koppanen 07master * r9d0e122 10/ (acinclude.m4 Added option to choose internal polling system ...
[11:10] errordeveloper does anyone here know of PTP (IEEE 1588) ?
[11:21] strich PTP?
[11:41] errordeveloper strich: do you what it is ?
[11:41] errordeveloper I mean, I do .. just wonder if PTP could be glued with 0MQ
[11:42] errordeveloper I mean, if it could be done in somewhat semi-transparent fashion ....
[11:42] errordeveloper I just posted this quesion to the list btw
[11:42] errordeveloper my first post on 0mq
[11:43] errordeveloper :()
[11:43] strich You'd have to wrap it up at both end points I would think
[11:43] errordeveloper strich: It would quite an interesting thing to do, wouldn't it ?
[11:43] strich zmq is a carrier, using the TCP protocol
[11:43] strich ANy other protocols would have to be wrapped out at both ends
[11:43] strich *up
[11:44] errordeveloper I suppose I need to read on 0mq architecture
[11:45] errordeveloper hm .. I looked on github and there seem to be 3 release branches of 0mq
[11:45] errordeveloper (at least)
[11:45] errordeveloper is the protocol slightly different in all those version ?
[11:48] mikko errordeveloper: yes, there are some modifications
[11:48] mikko 2.1 is not compatible with 3.0
[11:52] errordeveloper ok .. but the API haven't changed, right ?
[11:53] mikko errordeveloper: minor changes between 2.1 and 2.2
[11:53] mikko ermm
[11:53] mikko 2.1 and 3.0
[11:53] errordeveloper ok
[11:53] mikko major version can break api
[11:53] errordeveloper gentoo comes with 2.1 as I can see
[11:53] errordeveloper I might stick to 2.1 for now then
[11:55] mikko you usually only need 3.0 for subscription forwarding
[11:55] errordeveloper ok
[11:56] mikko pre 3.0 topic matching was done on client
[11:56] mikko which causes extra network traffic
[12:03] michaelmi Hi all ..
[12:03] michaelmi This is my first zmq day, so please be patient ;-)
[12:04] michaelmi I have set up a simple request-reply scenario with a client and a server application in C
[12:06] michaelmi client:
[12:07] michaelmi server:
[12:08] michaelmi problem is: sometimes, the client seems to terminate before any data has been sent to the server
[12:08] michaelmi a sleep before the exit seems to avoid this beavior or at least make it less probable
[12:09] michaelmi is this intended? shouldn't zmq_close block until all data is delivered?
[12:09] mikko michaelmi: that doesn't look correct
[12:10] michaelmi mikko: I hoped so :-)
[12:10] mikko char data[] = "hello world xxx"; sprintf (data, "hallo welt %d", i);
[12:10] mikko doesn't the data get put to the text section?
[12:10] michaelmi oh ..well .. yes . I think so
[12:11] michaelmi or .. no .. mom
[12:11] michaelmi I initialize an array on the stack .. it's not "char *data = "hello world";
[12:12] mikko true
[12:13] mikko you shouldnt send terminating null
[12:13] mikko usually you send just the bytes
[12:13] mikko and terminate on other side if needed
[12:13] michaelmi ok
[12:13] mikko what version of zeromq is this?
[12:14] michaelmi libzmq-dev_2.0.10
[12:14] mikko that explains
[12:14] mikko if you upgrade it should be fine
[12:15] mikko there is no linger option in 2.0.x
[12:15] mikko linger sockopt behaves like SO_LINGER
[12:15] michaelmi ah .. thx .. gonna check this out
[12:16] mikko that code you have there is not deterministic with zeromq 2.0
[12:16] mikko as the sleep might or might not be enough to send the message fully
[12:16] michaelmi true .. I just wanted to get an indication that the exit() is part of the problem
[12:17] michaelmi tcpdump seemed to point in that direction
[14:00] michaelmi @mikko: just wanted to give feedback that with 2.1 the problem has vanished
[14:01] michaelmi thx!! & bye
[15:51] strich I've got a ROUTER/DEALER setup going nicely, but I'd like to cleanly shutdown and delete any associated content once a peer (DEALER) leaves after x seconds. How can I tell if a peer is no longer connected?
[16:02] strich No one?
[17:06] count strich: build another req/rep pipeline that heartbeats
[17:06] count and poll
[17:06] count ?
[17:07] count let me not use 'pipeline' there
[17:07] count a req/rep connection
[17:07] count :)
[17:07] strich So 2 connections per peer?
[17:07] count I guess, yes
[17:07] strich That sounds a bit excessive
[17:08] strich Can't I do it with router/dealer?
[17:09] count I guess you could just interleave a heartbeat between each work message on your router/dealer
[17:10] strich That is my plan currently
[17:10] strich I was hoping zmq had a bit more in-built intelligence for this stuff