2013-01-20

Configuring JMeter Part 11-How to configure TCP Sampler?

In this article we are going to see how can we configure jmeter by changing property of JMeter. In this section we will see the different mode settings for TCP Sampler in jmeter.propertie.

In the jmeter installed bin directory(in my case C:\apache-jmeter-2.8\bin), we get a file named jmeter.properties. Open this with note pad. Search for tcp sampler section in notepad and get the following. 


-To set default handler class
tcp.handler=TCPClientImpl

-To set byte value 111 for end of line[it will be from -128 to +127]
eolByte = 111
-To set this to a value [outside the range -128 to +127] (to skip eol checking)
tcp.eolByte=1000

-To set  TCP Charset
tcp.charset=
[Note : It is used by org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl default to Platform defaults charset as returned by Charset.defaultCharset().name().]

-To set status.prefix(start with the string, in here Status=) and suffix (strings for enclose the status response code, in here Full stop.)
tcp.status.prefix=Status=
tcp.status.suffix=.


-To specify status.properties (property file to convert codes to messages)
tcp.status.properties=mytestfiles/tcpstatus.properties

-To set length prefix (for LengthPrefixedBinaryTCPClientImpl implementation)[2 is default]

tcp.binarylength.prefix.length=2

Note : In that part, I could not use all. I will try this with an example later on.

..Thanks..:)

3 comments:

  1. Can you please provide a scenario where TCP sampler is used? I mean, when do we use TCP sampler and why? Thanks in Advance.

    ReplyDelete
    Replies
    1. yes, i did 2 years back. it was messaging service test which distributed over TCP protocol from central server. its pretty basic like http sampler. we check not only message response, we had to validate that.

      Delete
    2. When use? when there is a service exposed in TCP protocol. Usually small firmware/devices communicate each other via TCP protocol over, radio/wifi/Bluetooth communication. To test the service, it is impractical to use the devices sending request to the server. So, use Jmeter..:)

      Delete