TCP::respond

Description

Sends the specified data directly to the peer. This command can be used to complete a protocol handshake via an iRule.

Syntax

TCP::respond <data>

TCP::respond <data>

  • Sends the specified data directly to the peer by putting data directly into the egress queue without regard for buffer settings or congestion control. Note that unlike HTTP::respond, this command does not close the TCP connection. Your iRule will need to call TCP::close if you need it to do that.

Examples

when HTTP_REQUEST {
   if {([HTTP::method] eq "POST") && [HTTP::header exists "Expect"] } {
      HTTP::header remove "Expect"
      TCP::respond "HTTP/1.1 100 Continue\r\n\r\n"
   }
}
when SERVER_CONNECTED {
    peer { TCP::collect 4 }
}
when CLIENT_DATA {
    if { [TCP::payload] starts_with "EHLO" } {
        TCP::respond "500 5.3.3 Unrecognized command\r\n"
        TCP::payload replace 0 [TCP::payload length] ""
    }
    TCP::release
}