especially when connecting to a remote kafka host, some fread() calls might return an empty buffer since the data has not yet arrived: this does not mean the connection is broken or the batch delivery failed. Ideally, we should use a select() call on the socket to detect activity before fread(), or use blocking mode on the socket if we have a persistent connection to kafka (as opposed to hit-and-run polling)