in reply to Multi-process Win32 HTTP Daemon

Hint: The code you posted could *never* work.

# Create a client connection object "the hard way" my $c = HTTP::Daemon::ClientConn->new_from_fd( 'STDIN', "+>" );

'STDIN' is just a string no different from 'this' or 'That! or 'Hello world!'.

In particular, it is not the same as the bareword STDIN, which is a pre-opened filehandle, and the what is used in the original code that you downloaded:

# Create a client connection object "the hard way" $c = HTTP::Daemon::ClientConn->new_from_fd(STDIN, "+>");

However, that code doesn't make any sense either, as fdopen take an integer parameter not a filehandle glob, so I do not see how that would ever have worked.

If you change that line to

my $c = HTTP::Daemon::ClientConn->new_from_fd( fileno( STDIN ), '+>' ) +;

The code will work.

c:\test\546536>client Sending request... Got response Content: HTTP/1.1 200 OK <<<<<<<<<<<<<<<<<<<<< **** Note: No EOF *** +** Client-Date: Sun, 30 Apr 2006 18:44:08 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1 Date: Sun, 30 Apr 2006 18:44:08 GMT Server: libwww-perl-daemon/1.21 **** The content I assume you were expecting, but didn't mention even +when queried. ***** Content-Length: 56 X-Content:: <HTML><B>Pid: 1572</B> Sun Apr 30 19:44:08 2006</HTML> <HTML><B>Pid: 1572</B> Sun Apr 30 19:44:08 2006</HTML>

Free advice:

  1. If you download code from random sources and it doesn't compile with use strict, be suspicious.
  2. If you make changes to make it use strict complient, best to mention these when you post the modified code.
  3. If you do not understand enough about the code you've downloaded to recognise that the output you are receiving is a big fat clue:
    Got response Content: HTTP/0.9 200 (OK) EOF <<<<<< ******* EOF means End of file ** +*** Client-Date: Sun, 30 Apr 2006 05:50:47 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1

    And that the times being displayed are clearly labelled Client-time:

  4. If you cannot describe what is wrong with the output you are receiving

It's a pretty low trick to just throw the code onto a message board and expect others to sort out your problem.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Multi-process Win32 HTTP Daemon
by rfoskett (Initiate) on Apr 30, 2006 at 19:13 UTC
    Perfect it works, however as you mentioned the code would have never worked - hence the reason for posted in the first place.
    Thanks for your help