So I'm trying to complete this program for a job test that I have - here's part 1 that confuses me.
Parse a simulated incoming data stream, using the provided GetChar() function.
The format for the received data packets are given in the header file.
Validate the data packets and display to the console the received messages.
Provide error handling and recovery for invalid packets.
The simulated data stream is this:
static const char g_TestData[] = {'!', 'R', '0', '1', 'D', '4', '\n' ,
'!', 'W', '0', '2', 'D', 'A', '\n',
'!', 'R', '0', '2', '3', '0', '8', '\n',
'!', 'W', '1', 'A', '9', '\n'};
So thats great, I used their GetChar function to display that on the screen...I guess thats all I need to for the first part but what the heck do I need to do to validate the packets and do error handling? Basically every '!' is a new packet then its either 'R' or 'W' for read or write then a variable length of data in ASCII chars ending with the '\n' char. I've never had to do anything quite like this especially relating to data validation and error handling of packets...anyone got a clue?
Parse a simulated incoming data stream, using the provided GetChar() function.
The format for the received data packets are given in the header file.
Validate the data packets and display to the console the received messages.
Provide error handling and recovery for invalid packets.
The simulated data stream is this:
static const char g_TestData[] = {'!', 'R', '0', '1', 'D', '4', '\n' ,
'!', 'W', '0', '2', 'D', 'A', '\n',
'!', 'R', '0', '2', '3', '0', '8', '\n',
'!', 'W', '1', 'A', '9', '\n'};
So thats great, I used their GetChar function to display that on the screen...I guess thats all I need to for the first part but what the heck do I need to do to validate the packets and do error handling? Basically every '!' is a new packet then its either 'R' or 'W' for read or write then a variable length of data in ASCII chars ending with the '\n' char. I've never had to do anything quite like this especially relating to data validation and error handling of packets...anyone got a clue?