binary file output first, then text input, but failed.

There is a problem I encountered in Java socket programming. It is a C/S program.

What I want to do are:

1. Client sends a text message to Server

2. Followed by a binary file(jpg, word...) from Client to Server as well

3. After receiving the text message and the file, Server sends a text

acknowledgement back to Client

the first two steps can be achieved successfully. for the last step, it

seems Server is stuck after it receives the binary file from Client, thus cannot send out any message.

N.B., in Client, I close the output stream before Client begins to receive the text acknowledgement in order for Server to detect the -1 marker and finish the binary file receiving.

any idea? If you want to see my source code, I would like to post them here or send them to your email.

Thanks!

[856 byte] By [inte2uka] at [2007-10-3 2:24:19]
# 1
If you close the output stream you will close the socket completely, both input and output. You can send an EOF to the server while keeping the socket open for reading by calling Socket.shutdownOutput().
ejpa at 2007-7-14 19:23:18 > top of Java-index,Archived Forums,Socket Programming...
# 2
Thank you ejp. It works well.
inte2uka at 2007-7-14 19:23:18 > top of Java-index,Archived Forums,Socket Programming...