Krystian Gor wrote:Wow, I didn't know it works like this.
It doesn't necessarily work that way all the time. But if you open an InputStream, that means you're establishing a connection and probably plan on downloading some data. It's not that surprising that it would pre-buffer some data for you, so that when you do ask for it, it's there. In fact, I wouldn't be surprised if the lower level TCP protocol has to send some bytes anyway--like a connection ACK or something--and, since it's going through the overhead of sending one or more frames anyway, it decides to piggyback some session- or application-level data on it.
If no data was ever put on the wire until the other end received your explicit request for it, the internet would be a much slower place.