08-27-2021, 05:50 AM
Hello,
We have 4G IOT adapter which can send json package to my delphi idtcpserver , i use
Memo1.Lines.Add('receiveString-> :' + AContext.Connection.IOHandler.Readstring(160));
but length of string is not fixed, like following 4 json packages, length of third one is different with others, so i can't fix in IOHandler.Readstring(???)).
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043052"}
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043053"}
{"devId":"492C201010012591","msgType":"rs485ValueRpt","data":"0103040ADC1786B643","timestamp":"1630043053"}
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043054"}
How can read these strings by idtcpserver?
Thank you!
Ike
We have 4G IOT adapter which can send json package to my delphi idtcpserver , i use
Memo1.Lines.Add('receiveString-> :' + AContext.Connection.IOHandler.Readstring(160));
but length of string is not fixed, like following 4 json packages, length of third one is different with others, so i can't fix in IOHandler.Readstring(???)).
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043052"}
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043053"}
{"devId":"492C201010012591","msgType":"rs485ValueRpt","data":"0103040ADC1786B643","timestamp":"1630043053"}
{"devId":"492C201010012591","msgType":"aiValueRpt","data":{"AI1":"0","AI2":"0","AI3":"0","AI4":"0"},"timestamp":"1630043054"}
How can read these strings by idtcpserver?
Thank you!
Ike