in reply to Fetching HTML Pages with Sockets

That code works for me without any warnings, although it would hang until I called flush(SOCK) after the print, where flush is defined as
sub flush { select($_[0]); my $t=$|; $|=1; $|=$t; }.

All of the functions you called above return undef on error, and set $! to an error number and "$!" to an error message. Why don't you check for errors?

btw, LWP comes with perl. You probably should be using that. For starters, it knows that "\r\n" will not always do what you want. Use "\xD\xA" instead of "\r\n". Also, should do local *SOCK to limit the scope of SOCK.

Replies are listed 'Best First'.
Re^2: Fetching HTML Pages with Sockets
by amt (Monk) on Sep 19, 2004 at 19:23 UTC
    Unfortunately, when I tried to use LWP::UserAgent it was not included in @INC, and getting my sysadmin to install anything, well, won't happen.
    When using the hex values, I get barked at for an invalid hex value.
    amt
      odd, it works for me in perl 5.6.1 and 5.8.0 How about octal? "\015\012"
        The octal codes work, but the program still hangs. I have tested my HTTP statements by telnetting to the host and typing them in, the trouble I am having is with this darn socket.

        amt