Multi

net.Curl. Multi

The multi interface offers several abilities that the easy interface doesn't. They are mainly:

  1. Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.
  2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application.
  3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneously.
  4. Enable event-based handling and scaling transfers up to and beyond thousands of parallel connections.

Members

(static) code

Returned results from net.Curl.Multi#.addHandle and net.Curl.Multi#.removeHandle.

Code Description
CALL_MULTI_PERFORM Please call curl_multi_perform() soon
OK No error
BAD_HANDLE Invalid multi handle
BAD_EASY_HANDLE Invalid easy handle
OUT_OF_MEMORY Out of memory
INTERNAL_ERROR Internal error
BAD_SOCKET Invalid socket argument
UNKNOWN_OPTION Unknown option
ADDED_ALREADY The easy handle is already added to a multi handle

(static) option

Option Description
MAXCONNECTS maximum number of entries in the connection cache
MAX_HOST_CONNECTIONS maximum number of (pipelining) connections to one host
MAX_PIPELINE_LENGTH maximum number of requests in a pipeline
CONTENT_LENGTH_PENALTY_SIZE a connection with a content-length longer than this will not be considered for pipelining
CHUNK_LENGTH_PENALTY_SIZE a connection with a chunk length longer than this will not be considered for pipelining
PIPELINING set to 1 to enable pipelining for this multi handle
PIPELINING_SITE_BL a list of site names(+port) that are blacklisted from pipelining
PIPELINING_SERVER_BL a list of server types that are blacklisted from pipelining
MAX_TOTAL_CONNECTIONS maximum number of open connections in total

(static) seekfunc

These are the return codes for the seek callbacks

seekfunc Description
OK
FAIL fail the entire transfer
CANTSEEK tell curl seeking can't be done, so curl might try other means instead

Methods

(static) strError(code) → {string}

Return the description for the given code

Parameters:
Name Type Description
code Number

See net.Curl.Multi.code

Returns:
Type
string

addHandle(easy) → {Number}

Add an easy instance and perform the request

Parameters:
Name Type Description
easy net.Curl.Easy
Returns:
Type
Number

getCount() → {Number}

Get the number of running easy instances

Returns:

number of running easy instances

Type
Number

onMessage(callback) → {Number}

Setup a callback whenever an easy request is completed (success of failure)

Parameters:
Name Type Description
callback Multi~onMessageCallback
Returns:
Type
Number

removeHandle(easy) → {Number}

Remove a running easy instance and stop it

Parameters:
Name Type Description
easy net.Curl.Easy
Returns:
Type
Number

setOpt(option, parameter)

Modify options for multi

Parameters:
Name Type Description
option Number

See net.Curl.Multi.option

parameter any

Type Definitions

onMessageCallback(easyHandle, result)

Callback when an curl easy request is completed (success of failure)

Parameters:
Name Type Description
easyHandle net.Curl.Easy
result Number

See net.Curl.Easy.code