in reply to Multi-process Win32 HTTP Daemon

Your code seems to work fine on my system (XP & AS811). What errors are you seeing?

Server trace over 20+ 5 connections. (20 worked fine, but showed nothing extra)

c:\test\546536>daemon.pl 532] Listener waiting for Requests on http://D4KG9X0J:2112/ 0] Accepted Connection spawned 1056 1056] 0 Request POST / HTTP/1.1 Connection: TE, close Host: 127.0.0.1:2112 TE: deflate,gzip;q=0.3 User-Agent: libwww-perl/5.801 Content-Length: 26 Content-Type: application/x-www-form-urlencoded q=blah&pg=q&avkw=tgz&kl=XX 1056] 0 sent response 0] Accepted Connection spawned 252 252] 0 Request POST / HTTP/1.1 Connection: TE, close Host: 127.0.0.1:2112 TE: deflate,gzip;q=0.3 User-Agent: libwww-perl/5.801 Content-Length: 26 Content-Type: application/x-www-form-urlencoded q=blah&pg=q&avkw=tgz&kl=XX 252] 0 sent response 0] Accepted Connection spawned 1008 1008] 0 Request POST / HTTP/1.1 Connection: TE, close Host: 127.0.0.1:2112 TE: deflate,gzip;q=0.3 User-Agent: libwww-perl/5.801 Content-Length: 26 Content-Type: application/x-www-form-urlencoded q=blah&pg=q&avkw=tgz&kl=XX 1008] 0 sent response 0] Accepted Connection spawned 1124 1124] 0 Request POST / HTTP/1.1 Connection: TE, close Host: 127.0.0.1:2112 TE: deflate,gzip;q=0.3 User-Agent: libwww-perl/5.801 Content-Length: 26 Content-Type: application/x-www-form-urlencoded q=blah&pg=q&avkw=tgz&kl=XX 1124] 0 sent response 0] Accepted Connection spawned 344 344] 0 Request POST / HTTP/1.1 Connection: TE, close Host: 127.0.0.1:2112 TE: deflate,gzip;q=0.3 User-Agent: libwww-perl/5.801 Content-Length: 26 Content-Type: application/x-www-form-urlencoded q=blah&pg=q&avkw=tgz&kl=XX 344] 0 sent response

Client trace

c:\test\546536>for /l %i in (1,1,5) do @start /b client.pl Sending request... c:\test\546536>Sending request... Sending request... Sending request... Sending request... Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:44 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1 Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:46 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1 Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:47 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1 Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:47 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1 Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:47 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1

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 10:06 UTC
    Unfortunately, the client response isnt correct in that it always reads the same regardless of response object formed on the server:
    Got response Content: HTTP/0.9 200 (OK) EOF Client-Date: Sun, 30 Apr 2006 05:50:47 GMT Client-Peer: 127.0.0.1:2112 Client-Response-Num: 1
    The client correctly prints the server pid & time when running through a normal HTTP::Daemon so think this is due to LWP::UserAgent/HTTP::Response on the client side.

      If you look back up at the client log I posted, you'll see that there are 3 different times produced amongst the 5 responses shown:

      Client-Date: Sun, 30 Apr 2006 05:50:44 GMT Client-Date: Sun, 30 Apr 2006 05:50:46 GMT Client-Date: Sun, 30 Apr 2006 05:50:47 GMT

      And if I run more client I get more different times. They are not all unique because 1 second is a long time in computer terms. It just means that the server was able to respond to 2 or more client connects within the same second. For a real server you would want to achieve a much higher rate than 1 per second.

      As far as I can tell from your code, all the other data are invarient. You could use Time::HiRes to get finer granularity to convince yourself, or perhaps add another header with a unique value.


      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.