How to use stream cipher to encrypt data in TcpStream

Thanks, so it is due to packet loss then the ciphers state not the same, I'm considering split stream data to blocks and do verifying, but I dont know how to handle that packet loss condition, is there any project I can reference for?