When using object streams over sockets, I have to flush the streams after each write operation. In fact I even have to flush the output stream soon after creation. Is there a way out of this?
The ObjectOutput interface provides a flush() method, implying that implementations are allowed to buffer the output. The semantics of buffered output are such that if you want the data to be sent immediately, you need to flush the buffer (the FAQ at http://www.jguru.com/jguru/faq/view.jsp?EID=32701 talks about this as well).
It seems you are expecting to be able to read the data on the other end of the stream immediately after it is written; as you have found out, the only way to ensure that the data is sent over the socket immediately is to flush the buffer. The alternatives, setting the buffer size to be very small or turning off buffering entirely, are not available with socket output streams.