When sending is blocking, it's necessary to check if there's any data available for receiving to avoid infinite lock.