Forum Discussion
TCP::Collect vs TCP::payload
I have a simple iRule as below
when CLIENT_ACCEPTED {TCP :: collect}
when CLIENT_DATA { if { [TCP::payload] contains "SomeName/SomeServiceNameHere/"} { pool APoolUsedByMyApplication }
My TCP data has 600 bytes. My intended data will be well within first 200 bytes and hence I changed to iRule as below.
when CLIENT_ACCEPTED {TCP :: collect 100}
when CLIENT_DATA { if { [TCP::payload 250] contains "SomeName/SomeServiceNameHere/"} { pool APoolUsedByMyApplication }
I am collecting only 100 bytes via TCP::Collect. But using TCP::Payload 250 and it works fine.
Am bit confused here. Do the TCP::Collect and TCP::Payload gets a fresh copy of data? Or Is Data collected in TCP::Collect is reused in TCP::Payload?
Please correct my understanding and any comments are helpful
Thanks in advance.
Hi Sathishkumar123,
the
command will make sure that you've buffered at least 100 bytes of data before the[TCP::collect 100]
event triggers. If more TCP payload data has been already arrived in the TCP buffer theCLIENT_DATA
command would be able to access this data too. And if less that 100 bytes of data has been already arrived, it will wait until the remaining data has been arrived (Note: This may stall your TCP connection if the client is requiring a response before sending additional data)[TCP::payload]
The
command will read a maximum of 250bytes from the TCP buffer. If more data is available in the TCP buffer it will accurately trunkate the payload for you. And if less that 250bytes of data are currently in the TCP buffer, it will simply fetch all available data without any complains...[TCP::payload 250]
Cheers, Kai
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com