usama ibrahim
usama ibrahim

Reputation: 63

TCP Sampler doesn't closes the connetion

I'm using TCP sampler to send a text type message. The thing is, I'm getting the response that I wanted but the JMeter's test run doesn't stop its-self after getting the response. Each time I've to click on the STOP button and then I get the response with a 500 error saying that "the server is unable to read from the server".

I've tried the following things:

  1. selecting the "close connection check box".
  2. Set end of line byte value to 10, 13 and 1200, 1300 in both JMeter GUI and JMeter properties (although I'm not sure how this works).
  3. Adding \0 and \r\n at the end of my TCP request message.

Non of the above things work. If anyone has a better solution for this kindly guide. I've seen some solutions saying "use JSR223 sampler to send requests" but I don't know its code tried writing the code too but failed. Anyone please?

Upvotes: 0

Views: 914

Answers (1)

Dmitri T
Dmitri T

Reputation: 168247

We don't know your server implementation, JMeter will attempt to read until the connection and the input stream are open, it expects the server to close the connection after receiving the response.

You need to either come up with your own implementation of the AbstractTCPClient and set it via "TCPClient classname"

enter image description here

or just specify a reasonable response timeout:

enter image description here

JMeter will mark the sampler as failed due to read timeout however you should be able to suppress this error by adding a Response Assertion configured like:

enter image description here

another pass/fail criteria could be added similarly

Upvotes: 0

Related Questions