Hi Mates,
My task is Sending 600 R_Data structures to the client by packing 100 R_Data structure variables into 1 packet (Structure R_Packet). So, Total 6 R_Packet will be sent from server to client via TCP Stream socket. As i said sequence number of each R_Packet will be stored in its header variable and Footer variable is reserved/used for storing the Checksum.Code:struct R_Data { unsigned short id; unsigned char flag; float value; time_t time_stamp; } struct R_Packet { struct R_Data packet[100]; // 100 R_Data packets unsigned int header; // Sequence number of packet (i.e; For 1st R_Packet variable, header=1, For 2nd R_Packet variable, header=2 ...) unsigned int footer; // will be reserved for checksum/CRC verification at client side };
I need your help for the implemntation/calculation of checksum or CRC for each R_Packet before sending and the checksum/CRC result will be stored in R_Packet.footer which will be used by client to verify the packet loss.
My Question is:
How to calculate the Checksum on this heterogenous type packet?
Any standard algorithms are there?
If u have any readymade checksum Code, Please Share!
I desperately Need your help!
Thanks and Regards,
Sravan Kumar.