Jmeter 500 error in TCP

2.2k views Asked by At

I have set up the TCP Sampler to pass XML data and check the return.

I have the proper IP address, the port number is correct and the data is ready.

However, I consistently get this error:

Thread Name: BasicCheck 1-1
Sample Start: 2017-09-06 00:12:59 UTC
Load time: 3520
Connect Time: 1
Latency: 0
Size in bytes: 0
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: org.apache.jmeter.protocol.tcp.sampler.ReadException: Error reading from server, bytes read: 0

Response headers:

SampleResult fields:
ContentType: 
DataEncoding: windows-1252

I know the server is up and operating, I put the username and password in the TCP Sampler locations in Jmeter. I simply don't know why I'm getting this error.

This is on a windows machine (obviously) to a straight TCP server.

1

There are 1 answers

0
user3660045 On

You need to do the following things to make this work:

  1. In the TCP sampler make EOL Byte value=10 Timeout (Miliseconds) for response enter value as 5000 or 10000
  2. Add user defined variables which you want to send as text through TCP sampler. Ex. I want to send the text as ${STX}2017105557|SAMPLEMESSAGE|Message2${ETX} so STX and ETX are my user defined variables.
  3. Add a bean shell PreProcessor to convert values to ASCII format.

Sample code:

[String STX = URLDecoder.decode(vars.get("STX"), "ASCII");
vars.put("STX",STX);
String ETX = URLDecoder.decode(vars.get("ETX"), "ASCII");
vars.put("ETX",ETX);][1]

Jmeter Script should look like this: TCP Sampler Jmeter script