After the hassle of interpreting incoming commands, and the uncertainties that surround even sending commands, I decided that I needed to get command sending buttoned up.
After several attempts at getting determined numbers of bytes from the PLM for both the local ack and the remote ack, I decided that a more naive method might be in order. This seems to work in all cases. Now when a command is to be sent, the entire command structure is sent to the PLM, then it is read back in a non-blocking fashion until there are no more bytes to be read. The last byte is checked for ack/nak, then a blocking read is started for the remote ack. Once the first character of the remote ack is received, then all the remaining bytes are read until the non-blocking read fails.
OPened socket 6 plcd[20159]: Network thread received: on for 00000001 plcd[20159]: GetDevice: Creating a new device 00000001 plcd[20159]: Transmission sending command: on to 00000001 Unhooking 6 plcd[20159]: Expanding Macro: outside lights plcd[20159]: Transmission sending command: on to 00146c07 plcd[20159]: SerialTransport::WriteByte '' 02 plcd[20159]: SerialTransport::WriteByte 'b' 62 plcd[20159]: SerialTransport::WriteByte '' 14 plcd[20159]: SerialTransport::WriteByte 'l' 6c plcd[20159]: SerialTransport::WriteByte '' 07 plcd[20159]: SerialTransport::WriteByte '' 0f plcd[20159]: SerialTransport::WriteByte '' 11 plcd[20159]: SerialTransport::WriteByte 'ÿ' ff plcd[20159]: SerialTransport::ReadByte '' 02 plcd[20159]: SerialTransport::ReadByte 'b' 62 plcd[20159]: SerialTransport::ReadByte '' 14 plcd[20159]: SerialTransport::ReadByte 'l' 6c plcd[20159]: SerialTransport::ReadByte '' 07 plcd[20159]: SerialTransport::ReadByte '' 0f plcd[20159]: SerialTransport::ReadByte 'ÿ' ff plcd[20159]: SerialTransport::ReadByte '' 06 plcd[20159]: PLMProtocol sent: 0262146c070f11ff plcd[20159]: PLMProtocol received ack: 0262146c070fff06 plcd[20159]: SerialTransport::ReadByte '' 02 plcd[20159]: SerialTransport::ReadByte 'P' 50 plcd[20159]: SerialTransport::ReadByte '' 14 plcd[20159]: SerialTransport::ReadByte 'l' 6c plcd[20159]: SerialTransport::ReadByte '' 07 plcd[20159]: SerialTransport::ReadByte '' 1c plcd[20159]: SerialTransport::ReadByte 'ô' f4 plcd[20159]: SerialTransport::ReadByte '`' 60 plcd[20159]: SerialTransport::ReadByte '+' 2b plcd[20159]: SerialTransport::ReadByte 'ÿ' ff plcd[20159]: PLMProtocol received remote ack: 0250146c071cf4602bff plcd[20159]: Transmission sending command: on to 001b8b19 plcd[20159]: SerialTransport::WriteByte '' 02 plcd[20159]: SerialTransport::WriteByte 'b' 62 plcd[20159]: SerialTransport::WriteByte 'b plcd[20159]: SerialTransport::WriteByte '' 8b plcd[20159]: SerialTransport::WriteByte '' 19 plcd[20159]: SerialTransport::WriteByte '' 0f plcd[20159]: SerialTransport::WriteByte '' 11 plcd[20159]: SerialTransport::WriteByte 'ÿ' ff plcd[20159]: SerialTransport::ReadByte '' 02 plcd[20159]: SerialTransport::ReadByte 'b' 62 plcd[20159]: SerialTransport::ReadByte 'b plcd[20159]: SerialTransport::ReadByte '' 8b plcd[20159]: SerialTransport::ReadByte '' 19 plcd[20159]: SerialTransport::ReadByte '' 0f plcd[20159]: SerialTransport::ReadByte 'ÿ' ff plcd[20159]: SerialTransport::ReadByte '' 06 plcd[20159]: PLMProtocol sent: 02621b8b190f11ff plcd[20159]: PLMProtocol received ack: 02621b8b190fff06 plcd[20159]: SerialTransport::ReadByte '' 02 plcd[20159]: SerialTransport::ReadByte 'P' 50 plcd[20159]: SerialTransport::ReadByte 'b plcd[20159]: SerialTransport::ReadByte '' 8b plcd[20159]: SerialTransport::ReadByte '' 19 plcd[20159]: SerialTransport::ReadByte '' 1c plcd[20159]: SerialTransport::ReadByte 'ô' f4 plcd[20159]: SerialTransport::ReadByte '`' 60 plcd[20159]: SerialTransport::ReadByte ''' 27 plcd[20159]: SerialTransport::ReadByte 'ÿ' ff plcd[20159]: PLMProtocol received remote ack: 02501b8b191cf46027ff