ltm rule command recvΒΆ

iRule(1)		      BIG-IP TMSH Manual		      iRule(1)



recv
       Receives data from a given sideband connection.

SYNOPSIS
       recv ((
		   ('-eol')
		   ('-peek')
		   ('-timeout' MSEC)
		   ('-status' VARIABLE)
	       )#)?
	       (NCHARS)?
	       SIDEBAND_CONNECTION
	       (VARIABLE)?

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.

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

        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:
	   received - Got the requested amount of data
	   closed - the connection was closed. Some data may have been
       received.
	   timeout - A timeout occurred. Some data may have been received.
	   failed - An unexpected error occurred

VALID DURING
       ANY_EVENT

EXAMPLES
	when HTTP_REQUEST {
	    set dest "10.10.145.1:80"
	    set conn [connect -protocol TCP -timeout 30000 -idle 30 $dest]
	    set data "GET /mypage/index.html HTTP/1.0\r\n\r\n"
	    send $conn $data
	    # recv 2000 chars get recv bytes error
	    set recv_2kbytes [recv -timeout 30000 2000 $conn]
	    log local0. "Recv data: '$recv_2kbytes'"
	    set length_recv [string length $recv_2kbytes]
	    log local0. "length_recv has $length_recv bytes in it."
	    close $conn
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-11.0.0 --First introduced the command.



BIG-IP				  2017-01-31			      iRule(1)