[Spread-users] Problem with Java client
jaroslaw.nozderko at polkomtel.com.pl
Mon Aug 22 05:26:51 EDT 2005
> My reason for considering TCP_NODELAY is to avoid holding
> onto data longer than necessary, hopefully leaving the buffer
> empty when the socket is closed. Regardless, I think it's an
> appropriate setting for the Java API to use, the same as the C API.
> From the description of SO_LINGER read after reading Theo's
> response, we should be using it in both the Java and C APIs.
> It seems like a more correct way to solve Jaroslaw's problem,
> as well as a generally good thing to use regardless,
> considering the kind of guarantees we're trying to preserve.
Definitely. However, using setSoLinger() in connect() and/or
calling shutdownInput() and shutdownOutput() on the socket
(which presumably call shutdown() with SHUT_RD and SHUT_WR,
respectively) before socket.close() in disconnect() didn't solve
the problem. Since it's probably not a good idea to
hardcode enabling TCP_NODELAY in connect(), I put it
in disconnect() as a workaround, just before sending final
KILL_MESS (together with your listener.join() in
stopListener()) - everything seems to work correctly
now (HP-UX, Linux, WinXP).
More information about the Spread-users