c++ - How to manage escape sequences? -
c++ - How to manage escape sequences? -
i'm trying write protocol much simple possible create 2 processes talk through socket. i'd separate command commands raw data. how can this? mean, if sockets carry bytes stream, how can protocol, example, distinguish escape sequence "esc stx" numbers sequence 2734? i've searched bit, not plenty suppose, since i've not yet found how solve problem.
thanks in advance.
establish message protocol.
for example:
+---------+-----------+----------+ | command | payload | checksum | | 2 bytes | 252 bytes | 2 bytes | +---------+-----------+----------+
the payload can contain pattern because payload fixed size.
for variable length message, message length should added:
+---------+----------------+-----------+----------+ | command | message length | payload | checksum | | 2 bytes | 2 bytes | ? bytes | 2 bytes | +---------+----------------+-----------+----------+
the length of payload determined size of message length field.
c++ c sockets
Comments
Post a Comment