In my test case, I must re-use two TCP connections. For example, firstly I created a TCP connection to the target address 10.0.0.2/554 and select the check box "Re-use connection" for I want to re-use it later; then I created another TCP connection to 10.0.0.2/555 and select the option "Re-use connection" also. But I found my second data will be sent from the first connection to 10.0.0.2/554, and no new connection to 10.0.0.2/555 is created. Obviously it's not my expected result. My suggestion: Adding the judgement about the target IP and Port, if they are different, the first connection should be closed and a new connection should be created even the check-boxes "Re-use connection" in these two Samplers both are chosen. In this way, we can avoid send the data to unexpected target address. But the better way is to support re-using for multi-connections. And they should be closed when "Re-use connection" is unchecked or the thread exiting. This feature is just what I want now. Thanks.
Date: Thu Dec 29 16:45:11 2011 New Revision: 1225587 URL: http://svn.apache.org/viewvc?rev=1225587&view=rev Log: Bug 52396 - TCP Sampler in "reuse connection mode" reuses previous sampler's connection even if it's configured with other host, port, user or password Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java jmeter/trunk/xdocs/changes.xml
Fixed in trunk, use nightly build as soon as it's available and report if issue is fixed or not: https://builds.apache.org/job/JMeter-trunk/lastSuccessfulBuild/artifact/trunk/dist/
Hi, Thank you for your quick reply. I haven't tried the nightly build but read the code, and I find it is able to support multi-connections reused now. But maybe here is a minor issue, from the method "threadFinished": public void threadFinished() { log.debug("Thread Finished"); //$NON-NLS-1$ closeSocket(); if (protocolHandler != null){ protocolHandler.teardownTest(); } The closeSocket method is called, and it will only remove and close the current TCP connection. The other re-used connections will not be closed. Maybe we need a method like closeAllSockets called by threadFinished to traverse all connections to close them. Thanks.
Good point, fixed. Date: Sat Dec 31 10:52:39 2011 New Revision: 1226061 URL: http://svn.apache.org/viewvc?rev=1226061&view=rev Log: Bug 52396 - TCP Sampler in "reuse connection mode" reuses previous sampler's connection even if it's configured with other host, port, user or password Modified: jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2692