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.

In reply to Re: Multi-process Win32 HTTP Daemon by BrowserUk
in thread Multi-process Win32 HTTP Daemon by rfoskett

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.