I want to do load testing for a server where i will be sending request with data continously.
Requirement: In jmeter , i want to send requests with data(text) through TCP protocol continously for long time and it should not wait for the response of the previous request for sending next request.As server does not send the response, the jmeter should send the request continously.
I used normal thread group with 10 connection with infinite loop and continous re-use for connections(threads) but as the jmeter is waiting for response, connections are active but data is sent only once.
I also tried JSR223 sampler with counter and loop controller but connections are active but request is not sent even once.
below is the script in groovy
` import org.apache.jmeter.protocol.tcp.sampler.TCPSampler;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.samplers.SampleResult;
// Retrieve the thread number (0-based index)
int threadNum = ctx.getThreadNum();
// Calculate the counter value based on the thread number
int baseCounterValue = 860181068935920;
int counterValue = baseCounterValue + threadNum;
log.info("Thread number: " + threadNum + ", Counter value: " + counterValue);
String dataToSend ="$,Lt4G,LCR,NR,86018106,,L,1,08022024,112732,20.791864,85.261978,13.,225,26,Air4G,28,42,11001,,20 02,298085.8,3477,*";
log.info("Current counter value: " + dataToSend);
// Get the sampler from the context
TCPSampler tcpSampler = new TCPSampler();
tcpSampler.setServer("dummy server");
tcpSampler.setPort("4242");
tcpSampler.setRequestData(dataToSend);
// Send the request
tcpSampler.sample();`
keshav kumar Goud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.