Chapter 8 Using the CSS Scripting Language
Using socket Commands
8-36
Cisco Content Services Switch Administration Guide
OL-5647-02
If you search for the string “Keepalive” as illustrated in the previous section, you
will find one result. In this case, the STATUS variable is set to 1.
You can combine the status code returned from the
grep
command with a
while
loop to step through all the search results line-by-line.
For example, enter:
show service
S1 | grep “:”
set
endIndex “${STATUS}“
set
index “1“
while
index “LTEQ“ “${endIndex}”
show service
S1 | grep -u${index} “:”
echo
“${UGREP}”
modify
index “++”
endbranch
Using socket Commands
To assist you in building a structured protocol, use
socket
commands in a script
keepalive. The socket commands allow ASCII or hexadecimal send and receive
functionality. Each command that has an optional
raw
keyword converts the data
from standard ASCII to hexadecimal. For example, “abcd” is “61626364” in
ASCII. In hex, it is “0x61 0x62 0x63 0x64”.
socket connect
To performs either a TCP connection handshake (SYN-SYNACK...) to a specific
IP address/port or a UDP connection by reserving the host/port, use the
socket
connect
command. The socket value is received in a ${SOCKET} variable in the
script.
The syntax for this command is:
socket connect host
ip_address
port
number
[tcp {
timeout
} {session}
{
nowait
}|
udp
{
session
}]
Note
The software can open a maximum of 64 sockets simultaneously across all scripts
on a CSS.
Содержание 11500 Series
Страница 16: ...Contents xvi Cisco Content Services Switch Administration Guide OL 5647 02 ...
Страница 18: ...Figures xx Cisco Content Services Switch Administration Guide OL 5647 02 ...
Страница 120: ...Chapter 3 Configuring User Profiles Where to Go Next 3 16 Cisco Content Services Switch Administration Guide OL 5647 02 ...