Called when data has been received on a socket. When the callback returns, the buffer will be
reused: therefore, if buf must be processed on a separate thread, it needs to be copied.
This method might be called concurrently by multiple threads, so it has to be reentrant
Parameters: packet -