Chapter 8
Using the CSS Scripting Language
socket waitfor
OL-5647-02
To fill up the socket's 10-KB internal buffer with data from the remote host, use
the socket waitfor command. This command is similar to socket receive except
that it returns immediately upon finding the specified string argument. Once the
CSS finds the specified string, it returns a ${STATUS} value of 0 (success).
Otherwise, it returns 1. You can further view the retrieved data using the socket
inspect command, as described later in this section.
The syntax for this command is:
socket waitfor socket_number [anything {timeout}|"string" {timeout}
{case-sensitive} {offset bytes} {raw}]
The options and variables are:
socket_number - Socket file descriptor (integer form). The descriptor value is
•
returned by the socket connect command.
anything - Any incoming data returns the call within the timeout period. If
•
any data is found, the command returns immediately and does not wait the
entire timeout period.
timeout - The optional timeout value that specifies the number of
•
milliseconds the CSS waits to find the string argument. Enter an integer from
1 to 15000 ms. The default is 100 ms.
•
string - The specific string that the CSS must find to result in a ${STATUS}
value of 0. Once the CSS finds the string, the command returns immediately
and does not wait the entire timeout period specified by the integer argument.
case-sensitive - The optional keyword specifying that the string comparison
•
is case sensitive. For example, "User:" is not equivalent to "user:".
offset bytes - The optional keyword and value indicating the number of bytes
•
after the beginning of the received data to find the string. For example, if you
specify a string value of a0 and an offset of 10, then the CSS will look for
"a0" 10 bytes after the beginning of the received data.
raw - The optional keyword that causes the software to interpret the string
•
values as hexadecimal bytes rather than as a simple string. For example, the
software converts "0D0A" to "0x0D 0x0A" (carriage return, line feed).
Cisco Content Services Switch Administration Guide
Using socket Commands
8-39