Re: [zeromq-dev] Multiple Router/Dealer

2014-09-15 Thread Goswin von Brederlow
On Fri, Sep 12, 2014 at 11:49:03AM -0700, Mohit Anchlia wrote: For my testing I've built a client (req) - router - dealer - worker (rep). I currently have multiple clients and workers, however I am trying to figure out how I can have multiple router/dealers. Is there a way to make

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
string response = string(static_castchar*(reply.data()),reply.size()); That is how I convert it to string. After that I use the url in webkit and the login message is only used in application. On 15.09.2014 01:05, Thomas Rodgers wrote: How do you display the string on the receiving end? On

Re: [zeromq-dev] Trouble compiling czmq under Visual Studio

2014-09-15 Thread Tom Quarendon
That certainly seems to have worked. Thank you. -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-boun...@lists.zeromq.org] On Behalf Of Pieter Hintjens Sent: 12 September 2014 23:34 To: ZeroMQ development list Subject: Re: [zeromq-dev] Trouble compiling

Re: [zeromq-dev] Trouble sending from ROUTER to DEALER

2014-09-15 Thread Riskybiz
I made a quick modification to check the size of the received identity frame. It shows as 32 bits. Console output is: router: Preparing router: Ready to receive --- Message Received --- Originator Identity: 32768 Size of identity frame:

Re: [zeromq-dev] Trouble sending from ROUTER to DEALER

2014-09-15 Thread Rodrigo Mosconi
On Mon, Sep 15, 2014 at 8:16 AM, Riskybiz riskybizl...@live.com wrote: I made a quick modification to check the size of the received identity frame. It shows as 32 bits. Console output is: router: Preparing router: Ready to receive --- Message Received

Re: [zeromq-dev] Trouble compiling czmq under Visual Studio

2014-09-15 Thread Joss Gray
Visual studio builds seem to get broken quite a lot because of this. Probably because the Travis CI doesn't support msbuild. On Mon, Sep 15, 2014 at 8:48 AM, Tom Quarendon tom.quaren...@teamwpc.co.uk wrote: That certainly seems to have worked. Thank you. -Original Message- From:

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
You have two choices: 1. Send the '\0' as part of the message (and set length to one more byte). 2. Append a '\0' after receiving the message. HTH. -- Gonzalo Diethelm DCV Chile -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Thanks for that! That fixed the login message, but it still sometimes cuts off the end of the url. Is there a max length limit? It is approx. 126 characters long. It cuts off like 5-7 chars I think and replaces them with the '@' followed by empty boxes as I said earlier. Thanks, David On

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Tom Quarendon
You have two choices: 1. Send the '\0' as part of the message (and set length to one more byte). 2. Append a '\0' after receiving the message. Uh, why? string(static_castchar*(reply.data()),reply.size()); doesn't assume the string is null terminated. It constructs string from pointer and

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
Good point. Forgot about the specific details for that C++ constructor. The null byte should not be required. As Tom points out, you should print out what you are sending and receiving (contents and length) and make sure it makes sense. HTH. -- Gonzalo Diethelm DCV Chile -Original

Re: [zeromq-dev] Trouble sending from ROUTER to DEALER

2014-09-15 Thread KIU Shueng Chuan
Well on my system the following line printf(identity frame size: %ld bytes\n, zmq_msg_size(messageIn)); inserted before your line in multiPartMsg.h id = *(static_castint*(zmq_msg_data(messageIn))); yields 5 bytes. The code at https://github.com/zeromq/libzmq/blob/master/src/router.cpp#L465

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Well, I've printed out size and it is correct. I've also shortened the message by 5 characters and it stopped cutting off the last characters (atleast I think it stopped, tried 15 times and it came correct every time). So I think the problem was in the length of the message. I don't know if it

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
No, this is not a (known) limitation. Did you print exactly what you are sending and what you are receiving? My guess is you are putting a null byte in the middle of what you are sending. -- Gonzalo Diethelm DCV Chile -Original Message- From: zeromq-dev-boun...@lists.zeromq.org

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Yes, I've printed that message. There can't be any NULL byte there. It is string success: appended with url. It is normal url like http://example.org/path/to/jsp?lang=en_US?session=session id here. That session ID contains numbers, characters and dashes. On 15.09.2014 17:30, gonzalo diethelm

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
Please create a short (as short as possible) example that shows this symptom, and post it to the list. -- Gonzalo Diethelm DCV Chile -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev- boun...@lists.zeromq.org] On Behalf Of Dávid Kaya Sent: Monday,

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Well I tried to recreate the problem but it works as intended in my short example. I really don't know where could be the problem since I am doing it exactly the same way in my example as in my application. Maybe the problem is in the std::string, because when I use std::string.replace() to

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
That usually happens... Try to focus on the differences between your short example and your real code. One point to focus on could be memory management: are you sure the messages you are sending are actually surviving until they get sent? A simple wrong way to manage this would be putting your

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
If it would be because of memory, the std::string.replace() would not fix, would it? Everything is done in one function, I don't think this is the problem. On 15.09.2014 19:11, gonzalo diethelm wrote: That usually happens... Try to focus on the differences between your short example and your

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
Without seeing any actual code, it is impossible to say. -- Gonzalo Diethelm DCV Chile -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev- boun...@lists.zeromq.org] On Behalf Of Dávid Kaya Sent: Monday, September 15, 2014 2:18 PM To: ZeroMQ development

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Thomas Rodgers
When you create a message via zmq_init_data() (which zmq::message_t does with the constructor args you specified, and specify NULL for the ffn argument, it becomes a const message, which means that ZeroMQ assumes ownership of the pointer you handed it (it's a cmsg type, e.g. *const* data). It

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Here is that function: http://pastebin.com/AgUuDqqK . On 15.09.2014 19:19, gonzalo diethelm wrote: Without seeing any actual code, it is impossible to say. -- Gonzalo Diethelm DCV Chile -Original Message- From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Thomas Rodgers
Message goes out of scope, destructor called, receiving side is getting a pointer to a free'd heap block. On Mon, Sep 15, 2014 at 10:27 AM, Dávid Kaya m...@davidkaya.sk wrote: Here is that function: http://pastebin.com/AgUuDqqK . On 15.09.2014 19:19, gonzalo diethelm wrote: Without seeing

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
Oh thanks a lot, didn't know this. So the correct way would be to have one pointer to message_t as a member of my class and before every send() I should rebuild it and delete it manually when I am done with the socket, right? Or should I have (message_t*) for every message I use? On 15.09.2014

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Thomas Rodgers
You can do something like - zmq::message_t ackMessage(message.size()); std::copy_n(message.data(), message.size(), ackMessage.data()); This constructor form will cause the message to allocate it's own storage (and thus free it appropriately), you then copy the contents of your string into the

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread gonzalo diethelm
You see, this is why it always helps to ask for a minimal code sample; it helps you refine your thoughts and it helps us to reason about your code. You should look into the functions that implement a message’s lifecycle. You can play with the function that gets called automatically after a

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Thomas Rodgers
You will need cast ackMessage.data() to char* (e.g. static_castchar*(ackMessage.data())) for that to work. On Mon, Sep 15, 2014 at 10:52 AM, Thomas Rodgers rodg...@twrodgers.com wrote: You can do something like - zmq::message_t ackMessage(message.size()); std::copy_n(message.data(),

Re: [zeromq-dev] ZMQ appends weird characters to message

2014-09-15 Thread Dávid Kaya
I've used memcpy() since I am not using c++11. Anyway, thank you all for help, really appreciate it! David On 15.09.2014 20:03, Thomas Rodgers wrote: You will need cast ackMessage.data() to char* (e.g. static_cast(ackMessage.data())) for that to work. On Mon, Sep 15, 2014 at 10:52 AM, Thomas

Re: [zeromq-dev] 0MQ-based proxy worker crashes with Assertion failed: pipe (bundled/zeromq/src/session_base.cpp:441)

2014-09-15 Thread Tomas Krajca
Hi, I've got a few more observations that I made over the weekend. It crashes whether I set linger=1 or linger=-1. It crashes whether it runs with gevent threads or POSIX threads. It crashes whether the DEALER in the master process talks over ipc or tcp with the REP workers. I also tried to