I am trying to use a Java library to communicate with a car via the serial port using OBD2 protocol. The protocol is simple: you send an ASCII string (e.g. "01 0d"), and the car answers with an ASCII value. I've found many libraries in the web, but there is one concept I don't understand in the examples. After every send command, the programmer put a call to sleep
. Why is that? For example:
send(pid)
sleep(200)
receive(response)
I don't understand, because read
is a blocking function call, so I should be able to wait on read
. Why is the additional call to sleep
?