Chapter 8
Using the CSS Scripting Language
Special Variables
SOCKET Variable
The SOCKET variable contains the connection ID associated with a host. When
you connect to a remote host, the SOCKET variable is set so that you can send
and receive messages by referring to this variable. When you use the socket
commands, the SOCKET variable is set automatically (see
"Using socket
Commands"
later in this chapter). When you make multiple connections using the
socket commands, save the SOCKET variable to another variable or it will be
overwritten.
For example, enter:
set EXIT_MSG "Failure to connect to host"
socket connect host 1.1.1.1 port 80
no set EXIT_MSG
set EXIT_MSG "Send: Failure"
socket send ${SOCKET} "GET /index.html\n\n"
no set EXIT_MSG
! Save current socket ID
set OLD_SOCKET "${SOCKET}"
! The new socket connect command will overwrite the old
! ${SOCKET} variable
set EXIT_MSG "Failure to connect to host"
socket connect host 1.1.1.1 port 80
no set EXIT_MSG
set EXIT_MSG "Send: Failure"
socket send ${SOCKET} "GET /index.html\n\n"
no set EXIT_MSG
set EXIT_MSG "Waitfor: Failed"
socket waitfor ${OLD_SOCKET} "200 OK"
socket waitfor ${SOCKET} "200 OK"
! Finished, cleanup
no set EXIT_MSG
socket disconnect ${OLD_SOCKET}
socket disconnect ${SOCKET}
Cisco Content Services Switch Administration Guide
8-20
OL-5647-02