how to read from a non-return socket stream?# Java - 爪哇娇娃
c*n
1 楼
after connection,
the server side just spits out a short string , which I know is less than
100 chars long.
so supposedly I could just wait 1 second, and read from the stream
whatever is available.
but the problem is that the stream does not terminate by a "\n", so I
can't do
readline
read(byte[] , int, int) doesn't work either, since I don't know the actual
length of the string.
apparently I can use NIO for this, but is there a simpler method?
Thanks
the server side just spits out a short string , which I know is less than
100 chars long.
so supposedly I could just wait 1 second, and read from the stream
whatever is available.
but the problem is that the stream does not terminate by a "\n", so I
can't do
readline
read(byte[] , int, int) doesn't work either, since I don't know the actual
length of the string.
apparently I can use NIO for this, but is there a simpler method?
Thanks