When I inspected the message msg received from the dealer (at ZmqRouterProtocol::msg_received) and found the value of message was <class 'list'>: [b'\x00\x80\x00\x00)', b'data', b'ask', b'0'], which has a extra element at position 0.
Then, I changed source code slightly, tried to send back message like this:
# self.transport.write(msg) # comment out the original codeself.transport.write([b'hello']) # change to this line
But this does no working, the dealer can't get any response.
Turns out I need sent message like this:
self.transport.write([msg[0], b'hello']) # add extra head to send message correctly
this just no feel right
So, my question is:
why there's a extra head (first element) in the message received in router
I'm new to python/pyzmq/aiozmq, so this maybe a very basic question for you guys, thanks.
I tried the very first example from doc, http://aiozmq.readthedocs.io/en/v0.8.0/examples.html#simple-dealer-router-pair-implemented-on-core-level , works just fine.
When I inspected the message
msg
received from the dealer (at ZmqRouterProtocol::msg_received) and found the value of message was<class 'list'>: [b'\x00\x80\x00\x00)', b'data', b'ask', b'0']
, which has a extra element at position 0.Then, I changed source code slightly, tried to send back message like this:
# self.transport.write(msg) # comment out the original code
self.transport.write([b'hello']) # change to this line
But this does no working, the dealer can't get any response.Turns out I need sent message like this:
self.transport.write([msg[0], b'hello']) # add extra head to send message correctly
this just no feel rightSo, my question is:
Thanks in advance.