Ok the below code loops through until the if statement evals to false, at which point the data is considered to be all recieved, and is processed. What do I put in this if statement that will evaluate to false when the client has pressed return after typing some text (\r\n?). I want the client to say something, and then hit return at which point I know he has finished what he has to say and can process it. Thanks a lot!
C#:
int BytesRead = networkStream.Read(bytes, 0, (int) bytes.Length);
if (check if return was pressed)
{
// There should be more data, so store the data received so far.
sb.Append(Encoding.ASCII.GetString(bytes, 0, BytesRead));
}
else
{
// All the data has arrived; put it in response.
ProcessDataReceived() ;
}
Last edited by a moderator: