Forum Discussion
TCP::respond works with both ASCII and HEXADECIMAL bases?
Hey guys,
I need to send back a message with the command TCP::respond.
The message starts with its size in HEXADECIMAL (like 0065) and the rest of the message is in ASCII.
That works? Or I have to use another command to do that?
- Kevin_Stewart
Employee
Can you give an example?
- Lucas_de_Aguil1
Nimbostratus
Like the example below, where the 0065 is hexadecimal and the rest is ascii:
when CLIENT_DATA { set message "0065thisisamessage" TCP::respond $message }
- Kevin_Stewart
Employee
Maybe this,
when CLIENT_DATA { set message "0065thisisamessage" TCP::respond $message TCP::payload replace 0 [TCP::payload length] "" }
This is technically how you would respond to a client with TCP data. Maybe the bigger question is if the client accepts it this way.
- Stanislas_Piro2
Cumulonimbus
Do you mean concatenate different format type?
Try
set message [binary format H4a* 0065 "thisisamessage" ]
- H4 means second parameter is 4 hex
- a* means third parameter is binary with not fixed length
ASCII encoding is binary... so use a* to include ascii string
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