The packet writing function is
put_packet ()
. It takes as argument a
struct rsp_buf and creates a well
formed packet, beginning with '$', with '#' at the end of data and a
valid 2 byte checksum (see Figure 2.2 in
Section 2.3 for packet representation
details).
The acknowledgment character is read using
get_rsp_char ()
(see Section 4.5.2.1). If successful ('+'), the function
returns. Otherwise the packet is repeatedly resent until ('+') is
received as a response.
Errors on writing are silently ignored. If the read of the
acknowledgment returns -1 (indicating failure of the connection or
end-of-file), put_packet ()
returns
immediately.