Parsing a packet using structs
When I was analyzing the source code of an opensource software, I found an interesting technique to parse incoming data in a very efficient way, using a struct. This technique works if the received data has a fixed length and structure; for example it applies very well to data “packets”. When receiving, the program normally stores incoming data…