[wp-hackers] Questions on execute-pings.php...

David Chait davebytes at comcast.net
Tue Apr 25 06:10:39 GMT 2006


Ahh. Yes, IF you sit around in C or Java or PHP and WAIT on the socket, then 
it's no improvement (in fact it's worse).

However, we're not talking about sitting and spinning synchronously on some 
data on the socket.  In fact, I'm not sure the socket is left open on the 
client (I believe you open a socket, send a GET (or whatever), close the 
socket).  I think.  The server goes merrily on its way (despite the socket 
closing on the remote end, since it is doing things...), thus gaining async 
processing.  Though, even if a socket closing would stop server execution 
(which might be the CGI case explained by Andy), at the worst you'd open the 
socket very early, and close it very late, at least gaining parallelism. 
And I seem to recall w/sockets you can tell it to "close gracefully", and 
then it's up to a driver-level layer to do so...

Anyway... We can always take this off-list, though I think up to this point 
it may be of interest to some budding coders... ;)

-d

----- Original Message ----- 
From: "Angsuman Chakraborty" <angsuman at taragana.com>
To: <wp-hackers at lists.automattic.com>
Sent: Tuesday, April 25, 2006 12:48 AM
Subject: RE: [wp-hackers] Questions on execute-pings.php...


> Why isn't it true for C/Java?  You open up a socket to a webserver.  That
spawns a 'thread' of execution of some sort to handle the connection.

It doesn't (on the client side or the side making the request) unless you 
explicitly spawn one to connect to the server. In this case the code is 
synchronously opening the socket and pasing some data.

Note: It does spawn (or resuse) a thread (or process) on the server side but 
that doesn't help the client making the request as it is waiting for the 
request processing to complete. The only way I can see to make this viable 
is to send UDP packets or explicitly spawn a thread. Can you create threads 
in php? I think not. The nearest I could find was ticks. But then even that 
most likely doesn't work when the request handling thread / process 
completes execution.

Thoughts?

> not just making it up. ;)

I too hope so :) though I simply cannot fathom the logic. I wish the author 
of this code would shed some light too.



More information about the wp-hackers mailing list