I am working on a network programming and I need a data structure to append data for the packet segmentation problem.
For example, if a client sent a packet of size 500 bytes and for some reason, server received the packet as smaller packets of size 250 bytes each.
On server side, it parses the header and gets the size of the packet and checks that it has received all the data client sent. If not I think it should store that into somewhere and appends the data that coming in later until it receives the size of data it should receive.
I am a newbie of network programming and I have been played with sample tutorials but these didn’t covered this exception handling.
I will be very appreciated if you guys can provide me any good advanced tutorials or references related to this topic.
Thanks in advance.
The MTU for ethernet is 1500 bytes and the minimum size of an ethernet packet is 64 bytes.
Therefore, I would use an array of 24 cells, each holding up to 1500 bytes. While not space-efficient, this array will accomodate any possible packet arrangement.