Hi,
Iam sending a byte array from server to client by using the below statement,
Server:
OutputStream os=s.getOutputStream();
byte[] encryptedData=encrypt(data.getBytes(),publicKey);
// where encrypt function returns a byte array
os.write(encryptedData);
And in client iam receiving it by the following code:
InputStream is=s.getInputStream();
InputStreamReader isr1=new InputStreamReader(is);
BufferedReader br1=new BufferedReader(isr1);
String data=br1.readLine();
//Again I converted that string value into bytes and printed it
System.out.println(data.getBytes());
But the byte array that contains a value on the server side is different when compared to the value that i got on client side.
The byte value at server side is:[B@1f3aa07
And the byte value iam getting after receiving the above value into a string variable and converting it back into byte array is: [B@15b9e68
How to solve this problem and how to get the same byte array value from server side to client side. Please, send if there is any code which is illustrating that problem.
Thanking you,