Hi Frank-Olaf,
You are right. Setting the SO_SNDBUF to 1 does not mean that the packets are sent one
byte at a time. The SO_SNDBUF sets the send buffer high-water mark. As I understand
it, this parameter influences the level at which the TCP implementation will trigger
actual sending on the w
Frank-Olaf,
Isn't this the worst possible solution? I mean *hideously* bad. Maybe I don't
understand it but here is what I think will happen,
set SO_SNDBUF to 1;
while(there is something to send) {
send 1 byte();
// that is:
// encapsulate that single *byte* in a TCP packet;
Ceki,
As I said there is a drawback if you do split (for whatever reason) the message into
pieces. Than you are right. But you are wrong if you believe while the buffer is only
one byte only one byte is send at a time. If you use write(byte[], int, int) the whole
array is send in on TCP packet
This sounds like a good idea, Frank-Olaf :)
I have found another solution which I think I am more happy with (although
it does require JDK 1.3). It also means that default buffering is OK.
My solution is to add a shutdown hook in my utility code that simply calls
Category.shutdown() when the JV
Ceki,
I think it will work but I think this reinvent the wheel. TCP do this already. See
also comment to Mark, set buffer size ...
I only don't know whether this works on all OS.
Kind regards
Frank-Olaf Lohmann
>>> Ceki Gülcü <[EMAIL PROTECTED]> 01.02.2001 14.47 Uhr >>>
Mark,
One thing you
Mark,
If you want to be on the save side set your send buffer size to 1. Setting it is not
guarantied by Java but I have tested with NT an there it works fine. Then if you write
something to the socket the write is blocked until your data is send or you get an
exception (timeout by the OS). If