Getting number of bytes sent/received with SSLSocket

Is there any way I can get the number of bytes sent/received with an SSLSocket, but after the handshake/encryption process ?
[138 byte] By [_brocoli] at [2007-9-26 4:12:49]
# 1

Hello,

Yes there is a way, while your reading your file:

import java.util.zip.*;//need to import this class

static int k = 0;

static InputStream inStream = null;

static OutputStream outStream = null;

static BufferedReader br = null;

Adler32 adler32 = new Adler32();

byte[] buffer = new byte[1024];

while ( (k = inStream.read(buffer))!= -1)

{

adler32.update(buffer, 0, k);

outStream.write(buffer, 0, k);

}

System.out.print(Long.toString(adler32.getValue() );

I hope it helps

paynepro at 2007-6-29 13:18:58 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2
Thanks, but your code simply tells me how to calculate the Adler-32 checksum on data passing thru streams.What I really want to know is how many bytes were sent on the network after I sent something thru an SSLSocket.
_brocoli at 2007-6-29 13:18:59 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 3
Ok, you want this for an over all value, to see how much was sent to the server?I'm working on a upload/download application and I check bothsides if its equal!! And if not I create a log file for these errors..Which one do you need, explain a little moreThanks
paynepro at 2007-6-29 13:18:59 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 4

You are not comparing the size of the data, but the checksum.

What I want is to know how many bytes were actually sent over the network, by that I really mean the number of bytes sent..

For example if I sent "Hello" thru an SSLSocket, I want an answer like "To send your hello message, 200 bytes have been sent thru the network, that includes the encryption, the keys, handshake, etc."

_brocoli at 2007-6-29 13:18:59 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...