Verify received data with the length of the data sent from client. Otherwise, it may fail when there was dirty data in the buffer for receiving.