send¶
Description¶
Syntax¶
send [-status <varname>] [-timeout <ms>] <connection> <data>
Sends data on a specified sideband connection, and returns an integer
representing the amount of data that was sent.
Arguments¶
- <connection> is the connection identifier returned from connect
- <data> is the data to send
- -timeout ms specifies the amount of time to wait for the data to be sent. The default is an immediate timeout.
-status varname will save the result of the send command into
varname
. The possible status values are:
- sent - the data was sent successfully
- timeout - the specified timeout has occurred
- closed - the sideband connection has closed
- busy - the local TCP refused to accept the data
Note: The
send
command may also raise a TCL error if the sideband connection was
already closed. If a TCL error is raised, the status variable may be
unset.
Examples¶
# Save some data to send
set data "GET /mypage/myindex2.html HTTP/1.0\r\n\r\n"
# Send the data with a 1000ms timeout on the connection identifier received from the connect command
set send_bytes [send -timeout 1000 -status send_status $conn_id $data]
# Log the number of bytes sent and the send status
log local0. "Sent $send_bytes with status $send_status"