Different Response Port than Request - JMeter TCP Sampler - jmeter

I am using TCP Sampler in JMeter. I am trying to test a application which accept request on 5000 port but send response on 5001. How can we configure JMeter to accept response on different port than request?

Just use 2 TCP Samplers, one for sending the request and another one is for reading the response.
In order to avoid "endless" waiting for the response of the TCP Sampler which will send the request set the reasonable timeout
The sampler will appear as failed in the results, you can use Response Assertion to "expect" this failure and to mark the request as passed:

Related

How to capture Multiple response for a same request in Jmeter

I am initiating the request from Jmeter using HTTP Request Sampler. In the body data i am sending the request and the application server sends back two different responses for the same request. After receiving the first response, Jmeter will close the request and in my scenario i need to capture the second response also. Kindy share your ideas on this.
Regards,
Chandru
Which protocol? In case of HTTP this is exactly how it supposed to work: one request -> one response, you can keep the underlying TCP connection alive so JMeter would re-use the connection for sending the next request, but HTTP Request sampler won't expect any additional responses.
In case of Server Side Events you will need to do some scripting in order to handle the situation like it's described in How to Load Test SSE Services with JMeter article
In case of WebSockets take a look at Read continuation frames.jmx example test plan

How to use existing websocket connection to another websocket request in jmeter?

How to use existing websocket connection to another websocket request in jmeter?
When I tried to use existing connect then as result it show me an error "Sampler configured for using existing connection, but there is no connection" . Please refer attached screenshot.
enter image description here
enter image description here
It looks like you're using 2 different WebSocket Samplers implementations:
JMeter-WebSocketSampler
and JMeter WebSocket Samplers
Your WebSocket Single Write Sampler:
Doesn't know anything about the connection established by the WebSocket Sampler
The WebSocket Sampler closes the connection after receiving the response
So if you want to continue with the WebSocket Single Write Sampler you need to:
Use WebSocket Open Connection sampler to establish the connection:
In the WebSocket Single Write Sampler tick use existing connection box
More information: JMeter WebSocket Samplers - A Practical Guide
If you want to continue with the WebSocket Sampler - tick Streaming connection box:
and remove the WebSocket Single Write Sampler and friends from the Test Plan

Does BeanShell Sampler support an http request and tcp response in JMeter?

in Jmeter, i want to add a beanshell sampler, which sends http get request and waits for tcp response. is it possible? if no, are there any other methods?
Beanshell Sampler supports everything which you're capable of implementing in Beanshell language so you're limited only by your imagination and/or skills
Since JMeter 3.1 you're supposed to be using JSR223 Test Elements and Groovy language instead of Beanshell so if you're at early stages of JMeter scripting assessment consider switching to JSR223 Sampler and Groovy language, it's better choice from at least performance perspective
As per OSI model HTTP is an application level protocol (level 7) and TCP is a transport level protocol (level 4) hence any HTTP response will be TCP response (using TCP protocol as underlying transport) so you will get a TCP response in any case. So it makes sense to send a HTTP request using TCP Sampler (or HTTP Raw Request sampler), this way you will "wait" for a TCP response.

How to continue in Jmeter, as if the http response is received correctly for an http request?

There is an http request that the server is not responding it with an "http or http/json response".
The server sends some tcp messages like [ACK] and [PSH,ACK].
But JMeter waits for an http response, because the request is http request sampler.
Is there a proper way that i can continue as if the response of this request is received correctly?
I am I correct in saying you're more looking for a TCP sampler rather than a HTTP sample?
TCP ACK is not response which you want I guess. It's just transport layer acknowledge. According to HTTP protocol there should be response for every request, I mean HTTP response. So your server doesn't work correctly and jMeter shows it.
Just compare the requests which JMeter sends with the requests the real browser sends, configure JMeter to behave exactly like the real browser and that would be it.
If you want a comprehensive answer you need to show:
Full HTTP Request details in Wireshark (like Follow HTTP Stream) from the real browser
The same for JMeter
Your HTTP Request sampler configuration (including any configuration elements involved like HTTP Header Manager)
Blind shot: can it be the case that your HTTP Request sampler invokes switching protocols and later communication happens using WebSockets?
If yes - double check that you're sending proper headers like:
Connection: Upgrade
Upgrade: websocket
and once done continue simulating the traffic using WebSocket Samplers

How to send http request without waiting for response from server

We are planning to do load testing of our server and we need to generate heavy load from Jmeter tool. But as per i know, jmeter waits for the response to create another request thread. Is there a way to create http request without waiting for response from the server using jmeter? if not, what are the available work around to generate heavy load keeping number of threads fixed?
Define a very small timeout in the HTTP Request sampler (or even better in HTTP Request Defaults so the setting would be applied to all HTTP Request samplers) like 1 millisecond so JMeter will close the connection right after sending the request
(Optional) To avoid JMeter marking requests as failed add Response Assertion and tick Ignore Status box
You can set in HTTP Request in the Advanced tab Timeout of Connect and Response with 1 ms
Connect Timeout Connection Timeout. Number of milliseconds to wait for a connection to open.
Response Timeout Response Timeout. Number of milliseconds to wait for a response. Note that this applies to each wait for a response.
If you need to return always success you can add with JSR223 PostProcessor and use prev variable:
prev.setSuccessful(true)

Resources