|
From: | Jim Melton |
Subject: | RE: Reading tags from ZMQ in Python |
Date: | Thu, 28 Oct 2021 21:31:31 +0000 |
Your ZMQ messaging is intrinsically defining a protocol. If you change the protocol, then you necessarily have to re-code the interfaces that use it. If you are sending your data as a ZMQ multi-part message, be aware that ZMQ delivers multi-part messages atomically. That is, although you have to code to receive
all the parts (Python is easier, with recv_multipart) then deserialize the parts into your data structure(s), there is no delay between “receiving” the first part and receiving the last part. The receipt/assembly of multi-part messages is handled in
the ZMQ core. You have to have control of at least one side of this interface. If you control the sender, you could choose to encode the data using PMT (see
gr::zeromq::pub_msg_sink(_impl) for example) and send a single serialized message vs. multipart messages. If you only control the receiver, you are stuck conforming to whatever the sender produces. --- Jim Melton From: Discuss-gnuradio <discuss-gnuradio-bounces+jim.melton=sncorp.com@gnu.org>
On Behalf Of Temir Karakurum Hi, I am looking for a general solution to separate IQ data and tags coming from ZMQ using python. I send RPC requests to receive finite samples via ZMQ. ZMQ messages arrive in many pieces where the first piece has
a header and the tags whereas the rest of the pieces include a short header. Currently I can separate the incoming zmq messages by manually separating the received message into header_magic, header_version, number of received tags, and so on by manually cutting the received message into
properly demarcated pieces. Then I can decode the pieces using either pmt.deserialize_str or np.frombuffer. However, a slight change in the tag or message architecture usually leads to a rewrite of the code. I was wondering whether there is a more general and robust solution regarding reading tagged messages arriving
via ZMQ. If anyone can point me to some existing examples available within the codebase or share their snippet for similar purposes I would be grateful. Best, Temir
CONFIDENTIALITY NOTICE - SNC EMAIL: This email and any attachments are confidential, may contain proprietary, protected, or export controlled information, and are intended for the use of the intended recipients only. Any review, reliance, distribution, disclosure, or forwarding of this email and/or attachments outside of Sierra Nevada Corporation (SNC) without express written approval of the sender, except to the extent required to further properly approved SNC business purposes, is strictly prohibited. If you are not the intended recipient of this email, please notify the sender immediately, and delete all copies without reading, printing, or saving in any manner. --- Thank You.
|
[Prev in Thread] | Current Thread | [Next in Thread] |