How do I feed long JSON documents via UDP? #965
Unanswered
pavel-kirienko
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to feed a sequence of long JSON messages, several KiB each, via the UDP server, but I am unable to do that because I think
ncbreaks my message into 1 KiB chunks (1024 bytes) which results in an "unexpected end of input" error:I am using it as follows:
my_command | nc -u localhost 9870my_commandoutputs large newline-separated JSON dicts. Here's one (it is a perfectly valid JSON dict):{"1030":{"_meta_":{"ts_system":1713128556.959323,"ts_monotonic":302431.128461,"source_node_id":4010,"transfer_id":3108,"priority":"nominal","dtype":"zubax.primitive.real32.Vector4VarTs.1.0"},"value":{"timestamp":{"microsecond":1713128556932304},"value":{"value":[18933.865234375,9.68315315246582,0.0,40378.70703125]}},"covariance_urt":[1957.89404296875,1062.9013671875,0.0,0.0,1845.5074462890625,0.0,0.0,1464034394112.0,0.0,422114689024.0]},"1031":{"_meta_":{"ts_system":1713128556.959048,"ts_monotonic":302431.128185,"source_node_id":4010,"transfer_id":3108,"priority":"nominal","dtype":"zubax.primitive.real32.ScalarVarTs.1.0"},"value":{"timestamp":{"microsecond":1713128556932304},"value":{"value":18933.865234375}},"error_variance":1957.89404296875},"1032":{"_meta_":{"ts_system":1713128556.959095,"ts_monotonic":302431.128233,"source_node_id":4010,"transfer_id":3108,"priority":"nominal","dtype":"zubax.primitive.real32.ScalarVarTs.1.0"},"value":{"timestamp":{"microsecond":1713128556932304},"value":{"value":9.68315315246582}},"error_variance":1845.5074462890625},"1033":{"_meta_":{"ts_system":1713128556.959991,"ts_monotonic":302431.129129,"source_node_id":4010,"transfer_id":3108,"priority":"nominal","dtype":"zubax.primitive.real32.ScalarVarTs.1.0"},"value":{"timestamp":{"microsecond":1713128556932304},"value":{"value":0.0}},"error_variance":1464034394112.0},"1034":{"_meta_":{"ts_system":1713128556.959821,"ts_monotonic":302431.128959,"source_node_id":4010,"transfer_id":3108,"priority":"nominal","dtype":"zubax.primitive.real32.ScalarVarTs.1.0"},"value":{"timestamp":{"microsecond":1713128556932304},"value":{"value":40378.70703125}},"error_variance":422114689024.0}}How do I make the UDP server wait for newline before attempting to parse the message? Or am I misunderstanding the nature of the problem?
Beta Was this translation helpful? Give feedback.
All reactions