Hello
I’m having issues to parse an incoming stream of keys and values in TCP format
this is the style of message I get
python >>>
b’\x02+\x00e\x12\x00Clock.DayTime.Time\x13\x0012/12/2017 00:10:38\x03’
b’\x02 \x00e\x12\x00Clock.DayTime.Long\x08\x0000:10:38\x03\x02\x1c\x00e\x14\x00Clock.DayTime.Second\x02\x0038\x03\x020\x00e\x17\x00Clock.DayTime.Universal\x13\x0012/12/2017 00:10:38\x03’
For instance, here I want to get:
Clock.DayTime.Long : 00:10:38
Clock.DayTime.Second : 38
Clock.DayTime.Universal : 12/12/2017 00:10:38
Tried some dumb string splitting at the beginning which quickly breaks with some messages…
So I try to parse it following the specifications but there s some irregularities from one message to another. I have the feeling it’s due to some decoding issue with UTF-8 maybe.
I’m using a cursor to navigate through the string with the different length informations.
but sometimes the length encoded in the bytes gets very high and exceeds the parameter key and value.
Here are the specs:
I was wondering if there was any recommendation for this kind of Parsing in Touch.
Are there some native functions that could help me?
thanks a lot,
Phil