(Socket) Detecting if the other end is finished sending data.

Hi guys! I'm writing a simple client server application in java and I dont want to include a message length header in my messages. How will I know if the other end is finished sending message? I mean without using an indicator char for the end of the message. A message from the sender could end with any byte.

Hope you could help me with this problem. Thanks! :-)

[378 byte] By [s.E.a.Na] at [2007-10-2 22:07:48]
# 1
I believe you just listed the two possible ways yourself...
tschodta at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...
# 2

Hi! thanks for ur reply..actually im afraid i cant use those options because specifically I'm writing a telnet client..Unfortunately the telnet server is a device which does not negotiate End Of Record Option.

Is there any other method that might help me with this problem?

Thanks.

s.E.a.Na at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...
# 3
IIRC telnet uses CR ("\r") or LF ("\n") or some combination of those to signal end of data.
tschodta at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...
# 4
That option I think is not applicable because telnet data may contain CR & LF characters at the middle. Thanks Anyway.. :-)
s.E.a.Na at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...
# 5

> Hi! thanks for ur reply..actually im afraid i cant

> use those options because specifically I'm writing a

> telnet client..Unfortunately the telnet server is

> a device which does not negotiate End Of Record

> Option.

>

Telnet doesn't send messages like you described either. Its only definition is line oriented.

So whatever you are doing on the server have it do something else at the end so you know it is done.

jschella at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...
# 6
By the way you should probably use a different protocol. And if someone else is telling you otherwise then you should point out to them that other protocols exist for a reason and attempting to use telnet for the purpose is likely to lead to problems due to the protocol and not your
jschella at 2007-7-14 1:24:33 > top of Java-index,Core,Core APIs...