Forum Discussion
beefy80
Nimbostratus
Apr 03, 2014Calculating a two byte header in message payload
Hello
I am currently writing a logging event to capture a message but I am finding that by enabling the TCP::collect event the processing is being slowed down by as much as 2 seconds. As the message...
John_Alam_45640
Apr 07, 2014Historic F5 Account
Good catch.
Your modification look great. Only a couple suggestions:
1) don't add the 2 to the message_length variable because it is used for the TCP::collect later, instead add it within the comparison operation. 2) Perform the second the TCP::collect in the else statement so that it can be avoided if not needed.Here is what it would look like:
when CLIENT_ACCEPTED {
TCP::collect 2
set header_collected "false"
}
}
when CLIENT_DATA {
if { not ($header_collected) } {
Comment out one of the two binary scan lines below.
use this form if lower order byte is last (big endian order)
binary scan [TCP::payload] S message_length
use this form if lower order byte is first (little endian order)
binary scan [TCP::payload] s message_length
as the message length collected does not include itself add 2 more onto the result
if { $message_length > 0 } {
set header_collected "true"
check if we already have the required data in the buffer if so
capture the payload in vars and release it
if {[TCP::payload length] == [expr { $message_length + 2 }] } {
set vars with payload info for HSL logging later
set my_req_msg_payload [TCP::payload]
set my_req_msg_length [TCP::payload length]
release the data already collected
TCP::release
} else {
collect data with the required length
TCP::collect $message_length
}
}
} else {
if we are here the actual message is collected.
set my_req_msg_payload [TCP::payload]
set my_req_msg_length [TCP::payload length]
TCP::release
}
}
- beefy80Apr 07, 2014
Nimbostratus
John, I have just tried your enhancement but this does not work for me until our software sends the request again then it works. I have reverted to the previous version of code that I included. I like the code on 11.4 not aware of the procedures function however I am on 11.3 at the moment but will keep that in mind for the future. - John_Alam_45640Apr 07, 2014Historic F5 AccountThanks for the feedback. Good luck.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
