[security-dev 00108]: Re: JSSE sends a packet for every send()?

Florian Weimer fw at deneb.enyo.de
Fri Mar 14 00:39:25 PDT 2008

* Max Wang:

> I'm sending a byte[100] on client side using 100 calls of
> write(int). When receiving them on the server side using
> read(byte[100]), I need  to call it 100 times and each time it only
> returns 1.
> Does this mean the client generates one SSL packet for each write()
> call? 

Sort of.  TLS has got an internal record layer.  The kernel probably
still collects multiple such records into one TCP segment (thanks to the
Nagle algorithm), but the receiving side can still see the individual
write operations thanks to the record layer.

> Why cannot it collect enough bytes before sending them if the
> user hasn't call flush()? Is this behavior documented somewhere?

I think you need to wrap it with a BufferedOutputStream if you want this
type of behavior.

(I think you are supposed to ask such questions on some of those
forums. *sigh*)

More information about the security-dev mailing list