java - Socket Programming - CipherStream -


I am doing file transfer (socket-java) programs where I am sending an encrypted version of the file to the customer. The customer will decrypt it and store it in its drive.

I am using the CipherOutputStream ANF cipher inputstream for encryption and decryption. When my problem is encrypted, I have to close seeperoptrast and the file is not getting to the client. I need to get the receipt from the customer after sending the file, because I am closing the cipher output stream in the server, this message from the client Is not receiving Its throwing socket closure exception.

Is there another way to send a file in an encrypted format to the client so that the client will decrypt it and store it in its repository.

Please require some advice.

Once the stream is closed, you can not send

as My comment has been written, You can send the length of the file first to the customer, so that the customer will know how much byte he has to read. Once the client reads this amount of data, then the client can send them back because the stream is not closed. After the server receives a receipt, it can close the stream or start another transfer.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -