C
C
Chvalov2015-08-31 21:06:31
Java
Chvalov, 2015-08-31 21:06:31

Physicaloid returns split response, how to fix?

When I receive a command from the controller, the answer I get is broken into parts, it breaks somehow randomly:
Here's what I get:

// 1 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]

// 2 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]

// 3 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]

akCu6.pngI highlighted the answers with colors
Here is the full log: pastebin
What could be the problem ??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2015-08-31
@gbg

I see clearly, you do not understand the difference between a block protocol and a stream protocol. In the streaming protocol (which is the serial port), any number of bytes that ended up in the buffer can fall into your application. Please write an application protocol in such a way as to be able to find the boundaries of messages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question