最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

performance - How do I include STX (Start of Text) and ETX (End of Text) characters as prefixes and suffixes to TCP Sampler in J

programmeradmin1浏览0评论

I'm sending a text to server which a Socket message connected via a Port and IP I've used JSR223sampler to check the connection, which says "Connected"

This is my Text message PLPL|WM|SL|AS|PICK|100002001|PICKORDER|I|GPick059|2025-04-30 22:05:09.00||E|N|Y||MX1| GPick059|T123456001|1|JProd02|1

I've tried using the Escape Sequence \x02 for STX character. \x03 represents the ETX character. However the message I see on the server logs is with the Escape Characters and not STX and ETX.

I've used TCPClientImpl and BinaryTCPClientImpl TCPClient Classes

Message in the Server Logs:

07:37:34.097 [8] (null) INFO Interface.SocketProcessing.SocketProcessBase - Client IP:63862 Message : \x02PLPL|WM|SL|AS|PICK|100002001|PICKORDER|I|GPick059|2025-04-30 22:05:09.00||E|N|Y||MX1| GPick059|T123456001|1|JProd02|1 \x03

I'm sending a text to server which a Socket message connected via a Port and IP I've used JSR223sampler to check the connection, which says "Connected"

This is my Text message PLPL|WM|SL|AS|PICK|100002001|PICKORDER|I|GPick059|2025-04-30 22:05:09.00||E|N|Y||MX1| GPick059|T123456001|1|JProd02|1

I've tried using the Escape Sequence \x02 for STX character. \x03 represents the ETX character. However the message I see on the server logs is with the Escape Characters and not STX and ETX.

I've used TCPClientImpl and BinaryTCPClientImpl TCPClient Classes

Message in the Server Logs:

07:37:34.097 [8] (null) INFO Interface.SocketProcessing.SocketProcessBase - Client IP:63862 Message : \x02PLPL|WM|SL|AS|PICK|100002001|PICKORDER|I|GPick059|2025-04-30 22:05:09.00||E|N|Y||MX1| GPick059|T123456001|1|JProd02|1 \x03

Share Improve this question edited Mar 28 at 11:50 g90uagk asked Mar 28 at 11:42 g90uagkg90uagk 4192 gold badges6 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You can use __groovy() function like:

${__groovy(URLDecoder.decode('%02'\, 'ASCII'),)}

and

${__groovy(URLDecoder.decode('%03'\, 'ASCII'),)}

More information: How to Send Control Characters Using the JMeter TCP Sampler?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论