How to read tcp input until delimiter is found?

How do you read the tcp input stream until a specific separator in C # is defined? The only possible solution I came up with is reading the incoming stream one byte at a time.

+5
source share
1 answer

Reading a TCP socket and scanning a delimiter are two different things.

You can read all the available data in a non-blocking socket into a byte array / string, and then scan the byte array for your separator. Do whatever you need, including possibly saving data after the delimiter for the next read attempt.

- , .

+6

All Articles