Please provide logs with those invalid messages.
In bold the problematic string. It is the only doesnt finish with 0d0a
2017-01-11 07:47:06 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343730312e3937382c412c333933362e303534302c4e2c30303233392e373238382c452c303031362c3135312c3131303131372c2c2a31437c31312e357c3139347c313030317c353732372c303030307c30303932313030307c30303030303085180d0a 2017-01-11 07:47:06 INFO: [570F7D22] id: 66104024211743, time: 2017-01-11 07:47:01, lat: 39.60090, lon: 2.66215, speed: 16.0, course: 151.0 2017-01-11 07:47:23 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343731352e3937382c412c333933352e393936342c4e2c30303233392e373739362c452c303031392c3134352c3131303131372c2c2a31437c31312e357c3139347c313030317c353732392c303030307c30303932313030307c303030303030 2017-01-11 07:47:45 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343733372e3937382c412c333933352e383530332c4e2c30303233392e393034372c452c303032392c3134352c3131303131372c2c2a31437c31312e357c3139347c313030317c353733322c303030307c30303932323030307c3030303030306b910d0a 2017-01-11 07:47:45 INFO: [570F7D22] id: 66104024211743, time: 2017-01-11 07:47:15, lat: 39.59994, lon: 2.66299, speed: 19.0, course: 145.0 2017-01-11 07:48:15 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343830342e3937382c412c333933352e363430322c4e2c30303234302e303839372c452c303033352c3134382c3131303131372c2c2a31437c31312e357c3139347c313030317c353733452c303030307c30303932323030307c303030303030685b0d0a 2017-01-11 07:48:24 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343832312e3937382c412c333933352e353635312c4e2c30303234302e313630392c452c303031322c3130392c3131303131372c2c2a31437c31312e357c3139347c313030317c353734322c303030307c30303932323030307c303030303030e5040d0a 2017-01-11 07:48:45 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343834322e3937382c412c333933352e353238302c4e2c30303234302e333331332c452c303032362c3131352c3131303131372c2c2a31437c31312e357c3139347c313030317c353734422c303030307c30303932333030307c30303030303087c70d0a 2017-01-11 07:49:08 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343835352e3937382c412c333933352e343237372c4e2c30303234302e333438322c452c303032382c3139312c3131303131372c2c2a31437c31312e357c3139347c313030317c353735322c303030307c30303932333030307c3030303030305c820d0a 2017-01-11 07:49:21 DEBUG: [570F7D22: 5009 < xx.xx.33.126] HEX: 242400736610402421174399553036343931362e3937382c412c333933352e333437362c4e2c30303234302e323936362c452c303031352c3137382c3131303131372c2c2a31437c31312e357c3139347c313030317c353735362c303030307c30303932333030307c3030303030307ef10d0a
It's definitely a device issue. Message length doesn't match the value in the header, so unfortunately it's not possible to do anything on the server side. You should ask vendor to fix the problem and provide a new firmware version.
And is it posible to discard the string if it is less than 230 char and it is not a heart beat?
Or if the message length is different than the header value?
It's not possible because TCP is a stream protocol. You never know where one message ends and the next begins.
I understand then that there is no way to find out that the chain is wrong.
In the log that I have sent you, you can see the wrong string, but do not know why it stops registering the following strings, until it sends a hartbeat when the engine has been turned off. Any idea why this can happen?
As I said, TCP is a stream protocol. The fact that you see each message as a separate packet is just a luck. Any message can be split into multiple or combined with others. There is no way to know where one message starts and ends without relying on the length in the header on each message.
Can I have your email address to talk about our TK228?
It seems that there is no much people using it....
Im trying to use obd 2 device tk228 for my uni project, I used same protocol that metions above. However I couldnt get realtime vehicle data or real time drver behavior. In apendex 2 they haven't provide request commands hex code for that data. Do you guys has any other document plz sent to me. Or give me a advice,
You should start with this:
If it doesn't help, you should create a new thread and provide all the information including all troubleshooting steps that you did.
I just found this tread on T228 and I would like to get in contact with @joseant and @swg. How did you do with this device? Does it work as you hoped, did you get new firmware to handle driver behavior? Im trying to find a device to work 100% with TRACCAR that has the feature RFID and my plan is to attend to the fair in Hong Kong Electronic Fair and meet up with the manufacturer of TK228.