<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" > <head><meta content="text/html;charset=&quot;utf-8&quot;" http-equiv="Content-type"/><link href="faldoc.css" rel="stylesheet" type="text/css"/><title> - Class Multi</title></head><body class="faldoc"><ul class="navi_top"><li class="top"><a href="index.html">Top: Table of contents</a></li> <li class="up"><a href="curl.html">Up: cURL Http/Ftp library binding.</a></li> <li class="prev"><a href="curl_Handle.html">Previous: Class Handle</a></li> <li class="next"><a href="curl_function.html">Next: Functions</a></li> <li class="clear"></li> </ul><div id="page_body"><h1><span class="toc_number">7.3</span>Class Multi</h1><p class="brief">Interface to CURL multi_* operations. </p> <pre class="prototype">Class Multi( [...] )</pre> <table class="prototype"> <tbody><tr class="optparam"><td class="name">...</td><td class="content"> <a href="curl_Handle.html">Handle</a> instances to be immediately added. </td></tr> </tbody> </table> <p>The Multi interface is meant to perform multiple CURL connections handled by a single application. </p> <p>A <b>Multi</b> instance lifetime is usually like the following: <ul><li>Add one or more pre-configured <a href="curl_Handle.html">Handle</a> instances. </li><li>Loop on <a href="curl_Multi.html#perform">Multi.perform</a>() up to when it returns 0 indicating that all transfers are complete. </li></ul></p> <p>For example, a minimal operation may be like the following: </p> <pre> import from curl h1 = curl.Handle( "http://www.falconpl.org" ).setOutString() h2 = curl.Handle( "http://www.google.com" ).setOutString() hm = curl.Multi( h1, h2 ) loop v = hm.perform() > "Currently ", v, " transfers ongoing." sleep(0.1) end v == 0 > h1.getData() > h2.getData() </pre><table class="members"> <tbody><tr class="member_type"><td class="member_type" colspan="2">Methods</td></tr> <tr><td><a href="#add">add</a></td><td>Adds an <a href="curl_Handle.html">Handle</a> instance to the multi interface. </td></tr> <tr><td><a href="#perform">perform</a></td><td>Starts or proceeds with the transfers. </td></tr> <tr><td><a href="#remove">remove</a></td><td>Adds an <a href="curl_Handle.html">Handle</a> instance to the multi interface. </td></tr> </tbody> </table> <h2>Methods</h2><h3><a name="add">add</a></h3><p class="brief">Adds an <a href="curl_Handle.html">Handle</a> instance to the multi interface. </p> <pre class="prototype">Multi.add( h )</pre> <table class="prototype"> <tbody><tr class="param"><td class="name">h</td><td class="content"> The <a href="curl_Handle.html">Handle</a> instance to be added. </td></tr> </tbody> </table> <p>Adds a handle to an existing curl multihandle. </p> <h3><a name="perform">perform</a></h3><p class="brief">Starts or proceeds with the transfers. </p> <pre class="prototype">Multi.perform()</pre> <table class="prototype"> <tbody><tr class="return"><td class="name">Return</td><td class="content">The count of remaining operations to be handled. </td></tr> </tbody> </table> <p>The calling application should call repeatedly this method until it returns 0, indicating that all the transfers are compelete. </p> <h3><a name="remove">remove</a></h3><p class="brief">Adds an <a href="curl_Handle.html">Handle</a> instance to the multi interface. </p> <pre class="prototype">Multi.remove( h )</pre> <table class="prototype"> <tbody><tr class="param"><td class="name">h</td><td class="content"> The <a href="curl_Handle.html">Handle</a> instance to be added. </td></tr> </tbody> </table> <p>Adds a handle to an existing curl multihandle. </p> </div><ul class="navi_bottom"><li class="top"><a href="index.html">Top: Table of contents</a></li> <li class="up"><a href="curl.html">Up: cURL Http/Ftp library binding.</a></li> <li class="prev"><a href="curl_Handle.html">Previous: Class Handle</a></li> <li class="next"><a href="curl_function.html">Next: Functions</a></li> <li class="clear"></li> </ul><div class="signature">Made with <a href="faldoc 3.0">http://www.falconpl.org</a></div></body></html>