I would like to be able to get the length of the data available from a TCP network stream in C# to set the size of the buffer before reading from the network stream. There i
You could send the lenght of the incoming data first.
For example:
You have data = byte[16] you want to send. So at first you send the 16 and define on the server, that this length is always 2 (because 16 has two characters). Now you know that the incomingLength = 16. You can wait now for data of the lenght incomingLength.