Follow

How to Send Control Characters Using the JMeter TCP Sampler?

JMeter’s TCP Sampler knows how to send ASCII text right out of the box.

 
But, what happens when we want to use one of the ASCII Control Characters (CC) that cannot be represented via the keyboard?
 
Say for example you want to send a ‘new line’ or ‘start of the header’
- Start of Header (SOH)
- Acknowledge (ACK)
 
Define a JMeter variable called SOH in your jmx script with the value %01 (which stands for SOH ascii CC).
 
Add a Beanshell sampler/pre-process element (Before the TCP Sampler) and paste this code:
 
String result = URLDecoder.decode(vars.get("SOH"), "ASCII");
vars.put("SOH",result);
 
Your script should look like this:
 
 
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.