Using socket Commands
Using socket Commands
socket connect
Note
Cisco Content Services Switch Administration Guide
8-36
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
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".
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}]
The software can open a maximum of 64 sockets simultaneously across all scripts
on a CSS.
Chapter 8
Using the CSS Scripting Language
OL-5647-02