Re: reading from (TCP) sockets

2017-08-12 Thread Chas. Owens
Sockets cannot tell you how much data will come in any language. You HAVE to rely on Content-Length, that is what it is for. Why do you think "It doesn´t seem wise to rely [it]"? It is not possible for a loop to both be blocking (which means it is using no CPU until signaled there is data) and u

reading from (TCP) sockets

2017-08-12 Thread hw
Hi, when reading data from a TCP socket, how do I tell when I have received all the data I should have received? Particularly, I´m trying to read data sent by a web server, so I´m opening a socket, send an HTTP request and receive an answer. Apparently I need to read from the socket in an endles