zeromq / zmqpp

0mq 'highlevel' C++ bindings
http://zeromq.github.io/zmqpp
Mozilla Public License 2.0
439 stars 195 forks source link

Assertion failed: sizeof(int32_t) == size(part) #154

Closed sunkin351 closed 8 years ago

sunkin351 commented 8 years ago

Assertion failed: sizeof(int32_t) == size(part), file C:\...\zmqpp\src\zmqpp\message.cpp, line 139

Does anyone know how to fix this by any chance? I get this when I try receiving a message on my server. EDIT: Might I add, I do need an answer real soon, I would like to get this project done as soon as possible so I can start on my next one.

xaqq commented 8 years ago

It sounds like you are trying to receive an int32_t (4 bytes) while the client is sending something else: maybe an int64_t (8bytes) or a int16_t? Is your client written using zmqpp too?

sunkin351 commented 8 years ago

It is written with the zmqpp bindings from scratch. However, it should be receiving a string, not a number.

EDIT: Unless there is something about the stream operators that I am missing... I did notice you guys used a template for operator>>...

sunkin351 commented 8 years ago

May I please get some acknowledgement that this issue is being worked on?

EDIT: Something is definitely not right with your template function operator>>, it asserts every time I try to use it.

xaqq commented 8 years ago

May I please get some acknowledgement that this issue is being worked on?

I have no problem sending string, so no it's not. Can you provide a reproducible example code so we can investigate why it doesn't work for you?

sunkin351 commented 8 years ago

Now that I make a "test" application, it doesn't assert... though it doesn't quite work... There is still the issue of data being corrupted during transport on my system (Microsoft Windows 10, MSVC 14 compiler). I send a string of characters, and I get something to the effect of Ç ), where pretty much next to nothing is received... Here is my source code I made on the fly to test this:

TestProgram.zip

Would this have something to do with character encoding?

sunkin351 commented 8 years ago

Send one message from the dealer socket but the router socket receives 2... The first one being not of any use to my application, as well as causing exceptions and unexpected/undefined behavior. I am unable to track down the problem, though I suspect the problem is within the socket class. Check what it does when you send something from a dealer socket with these bindings.

(EDIT: If this is an intended feature of the router/xreply socket, say, the first string is the identity of the sender, i am sorry, I have not been able to find online documentation for these bindings.) (EDIT2: Might even be something with libzmq, idk.)

sunkin351 commented 8 years ago

Nvm... I am so sorry for taking up your time, i didn't realize it would give me the client identity through the message... But thank you for your consideration...

xaqq commented 8 years ago

Yes the first frame of a message read on a router socket is the identity of the client. No problem, happy it works for you now.