I\'m trying to receive a part of a packet via recvfrom. It actually works like this:
recvfrom(sockfd, serialised_meta, 12, flags, src_addr, addrlen);
recvfro
UDP isn't a "stream" protocol... once you do the initial recvfrom, the remainder of the packet is discarded. The second recvfrom is awaiting the next packet...
UDP operates on messages, not streams like TCP does. There is a 1-to-1 relationship between sendto() and recvfrom() when using UDP. There is no option to receive partial data in UDP, it is an all-or-nothing type of transport. You have to recvfrom() the entire BUFLEN+12 message in one go, then decide whether you are going to actually use it or not. That is just the way UDP works.