in reply to My first socket program is SLOW?

If the page you're fetching is largish, reading it in 100 byte chunks and building it up by repeated concatentation:

while ($data) { recv(SK_CLIENT, $data, 100, 0); $thePage .= $data; }

could be a part of your problem. Something like

1 while read( SK_CLIENT, $thePage, 4096, length( $thePage ) );

might run a little more quickly.

Better still might be to read the first few lines of the response line by line and look for the Content-length header, and then read the rest in one go.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."