I am trying to create an app that opens a listening TCP socket and then reads all bytes written to the socket and then does something with those bytes. The server does not know the length of the data that will be written to the socket. Also, there is not a terminating character in the data that is sent. What I would like to do is simply read all the available bytes, delay a short while, and try to read more bytes, etc. Is there an easy way to do this? I would like to just do something like read 100 bytes with a timeout or 1 second, then if the read timesout, get all the data that is available and then start reading again.
Asked
Active
Viewed 71 times