recv

Description

This command receives data from an existing sideband connection (established with connect). It is one of several commands that make up the ability to create sideband connections from iRules.

Syntax

recv [-eol] [-peek] [-timeout <ms>] [-status <status_varname>] [numChars] <connection> [varname]

Receives some data (up to
numChars

bytes) from a sideband connection. If

varname

is specified, the response is stored in that variable, and

recv

returns the amount of data received. Otherwise,

recv
returns the response data.

Arguments

  • -timeout ms specifies the amount of time to wait for the data to be received. If unspecified, the default is an immediate timeout, and likely not what you want in a typical situation.

  • <varname> is the name of the variable in which to store the received data. If specified,

    recv
    

    will return the number of bytes received. If unspecified,

    recv
    
    will return the received data.

  • -eol causes the command to suspend until an end-of-line has been received or the timeout expires. The first line of data will be returned.

  • -peek will return the data received, but will leave it buffered for a subsequent call to

    recv
    


  • If -status status_varname is used, the status of the connection attempt is saved to

    status_varname
    

    . These are the possible return values for the recv status:

    1. received - Got the requested amount of data
    2. closed - the connection was closed. Some data may have been received.
    3. timeout - A timeout occurred. Some data may have been received.
    4. failed - An unexpected error occurred

Examples