Why is this ObjectInputStream constructor blocking?

The ObjectInputStream constructor is blocking even though I have already instantiated the corresponding ObjectOutputStream and called flush() to write the header.

Anyone have any idea why?

socket =new Socket(ipAddr, port);

socket.setSoTimeout(TIMEOUT);// timeout after 1 minute

output =new ObjectOutputStream(socket.getOutputStream());

output.flush();

input =new ObjectInputStream(socket.getInputStream());

[583 byte] By [dfasdfsdafsadfasdfa] at [2007-11-27 6:17:23]
# 1
Because the other side has written anything back to you.
cotton.ma at 2007-7-12 17:30:14 > top of Java-index,Java Essentials,Java Programming...
# 2
Sorry, I forgot to say that the socket connection is to localhost, so this thread is both sides.
dfasdfsdafsadfasdfa at 2007-7-12 17:30:14 > top of Java-index,Java Essentials,Java Programming...
# 3
> Sorry, I forgot to say that the socket connection is> to localhost, so this thread is both sides.Errr. No it isn't. Even when you connect to localhost you have two sockets. All I see here is you using one of them.
cotton.ma at 2007-7-12 17:30:14 > top of Java-index,Java Essentials,Java Programming...
# 4

To put it another way. Using localhost does not get you out of using two sockets (one at either end) or any other difference to your code at all.

The only difference in using localhost to a remote IP is that the performance will be rather significantly better. But it makes no diffference to your code in any way shape or form.

cotton.ma at 2007-7-12 17:30:14 > top of Java-index,Java Essentials,Java Programming...
# 5
Ah, I see my mistake now. Thanks for the the help. =)
dfasdfsdafsadfasdfa at 2007-7-12 17:30:14 > top of Java-index,Java Essentials,Java Programming...