in reply to simulating LWP's "results" with pure sockets

You need to tell the server that you're done sending. It's going to be sitting there waiting for an EOF so it'll never send an answer back. The way you do this is with the shutdown call. Something like:
shutdown SOCK, 1; my $data = (<SOCK>); print "result->$data\n";
This shuts down the writing side of the socket, dropping it into half-duplex mode, while leaving the read side open. The server catches an EOF on its end and is able to write back the status response. Pretty much classic HTTP.

The other way to do this (assuming a proper HTTP server) is to write the length of the file in the Content-Length header. The server can then know to stop reading once it gets that many bytes. However, your CGI doesn't use Content-Length to determin when it's done reading so...

c.

Replies are listed 'Best First'.
Re^2: simulating LWP's "results" with pure sockets
by zentara (Cardinal) on Mar 08, 2005 at 23:28 UTC
    Thanks, that did it. After all this time messing around with sockets, I was unaware of "shutdown", exactly what I was looking for.

    I'm not really a human, but I play one on earth. flash japh