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

Angsuman Chakraborty angsuman at taragana.com
Tue Apr 25 04:48:34 GMT 2006


> 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.

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com]On Behalf Of David Chait
Sent: Tuesday, April 25, 2006 2:59 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Questions on execute-pings.php...
Importance: Low


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. 
Something executes in the context of that 'thread'.  It does not happen in 
the context of the caller.  Now, whether/how the socket needs to stay open 
for that thread to not be stopped prematurely is another topic entirely. ;) 
But this should be caller-language independent -- only dependence is on the 
socket handling and execution handling on the server end.

I would assume/presume the person who added that code had done testing --  
and maybe had copied the approach from another project, not just making it 
up. ;)

-d

----- Original Message ----- 
From: "Angsuman Chakraborty" <angsuman at taragana.com>
To: <wp-hackers at lists.automattic.com>
Sent: Monday, April 24, 2006 5:01 PM
Subject: RE: [wp-hackers] Questions on execute-pings.php...


> using a socket effectively spawns it off on another thread, another 
> context,

Has this assumption been verified for php?

This isn't true for languages like C / Java. I haven't tested it for php but 
it seems that would be rather strange behavior.

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com]On Behalf Of David Chait
Sent: Tuesday, April 25, 2006 1:43 AM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] Questions on execute-pings.php...
Importance: Low


Someone correct me if I'm wrong... the 'include' would work within the
current thread, thus affecting the user response if something takes a while.
using a socket effectively spawns it off on another thread, another context,
without affecting the current session.

At least, that's what I seem to recall... ;)

-d

----- Original Message ----- 
From: "Angsuman Chakraborty" <angsuman at taragana.com>
To: <wp-hackers at lists.automattic.com>
Sent: Monday, April 24, 2006 2:36 PM
Subject: [wp-hackers] Questions on execute-pings.php...


Hi,

I don't understand why the query in the while loop which check for _pingme
rows doesn't check if the post is really ready to be pingbacked or
trackbacked (at least post_date < current time).

Also I am trying to understand the real reason behind calling this code via
a socket connection (instead of including it). is it merely in the hope that
due to the small timeout sometimes it will fail thereby achieving the
asynchronicity on pinback and trackback?

Can anyone please clarify.

Best,
Angsuman
http://blog.taragana.com/

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers

_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list