S
swebb99
Hi,
I need to write a java process that listens on a socket for a client
sending binary data (actually compressed messages). This socket will
always be open.
This data will then be written to another socket the other end of
which understands the content of the data. The problem I have is that
the data can be sent at any time and there is nothing in the data (no
characters) I can use to indicate the end of a raw message. So how can
I read the original data and decide that it should now be copied to
the out bound socket ?
If I call read(buff[]) then that blocks until the required number of
bytes is received which doesn't help me as I don't know how many bytes
there are, it could be 1 it could be 1000+. I noticed the socket class
has a setSOTimeout() method which might be useful but could I rely on
a timeout for detecting the end of the binary data associated with a
message !
Any idea's how I can cope with this ?
Thanks for any help
Steve
I need to write a java process that listens on a socket for a client
sending binary data (actually compressed messages). This socket will
always be open.
This data will then be written to another socket the other end of
which understands the content of the data. The problem I have is that
the data can be sent at any time and there is nothing in the data (no
characters) I can use to indicate the end of a raw message. So how can
I read the original data and decide that it should now be copied to
the out bound socket ?
If I call read(buff[]) then that blocks until the required number of
bytes is received which doesn't help me as I don't know how many bytes
there are, it could be 1 it could be 1000+. I noticed the socket class
has a setSOTimeout() method which might be useful but could I rely on
a timeout for detecting the end of the binary data associated with a
message !
Any idea's how I can cope with this ?
Thanks for any help
Steve