You can't. sf::Packet expects the size to be sent first; if it receives random data instead it can't know, and it'll wait until it has received the said number of bytes (which can be huge since it is random).
It's your job to ensure that sf::Packet only receives compatible data. I know it's not ideal, sf::Packet suffers from many design issues and it will hopefully be improved in the future, but that will not happen before SFML 3.