XML_RPC Improvements
| From: | Norman Elton | Date: | Mon, 01 Dec 2003 18:55:22 +0000 |
| Subject: | XML_RPC Improvements | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-24014@lists.php.net to get a copy of this message | ||
I have put together an improved version of XML_RPC:
http://people.wm.edu/~wnelto/RPC.php.txt
It allows you to create non-blocking xmlrpc requests. If, instead of invoking "send", you invoke "sendNonBlocking", you immediately get a special object returned that can be used to tell if the request is complete. This object has methods "ready" and "recv". The first tells you if the request is complete. The second will return the results. If you invoke "recv" before the request is complete, the function will block.
Hope this makes sense... Here's a trivial example. Admittedly I haven't tested this exact code, but you get the idea:
$msg = new XML_RPC_Message("example.method",array());
$cli = new XML_RPC_Client("/rpc.php","www.example.com","80");
$r = $cli->sendNonBlocking($msg);
while (!$response->ready()) {
sleep(1);
}
$response = $r->recv();
Of course, this isn't really useful. In this case, it is useful; however, if you want to make multiple requests and allow them to complete in parallel.
Comments?
Norman
------------------------------------------------------
Norman Elton
Information Technology - Network Engineering
College of William & Mary
757-221-7790