Hello,

We have a requirement to test a TCP service which expects requests in 
length-prefixed binary form and responds with data structured in the same way.

We have experimentally extended the TCP sampler code to support this by adding 
a "Length Prefixed Binary Data" option to the GUI.

With this option checked:

a) The TCPSampler sample() method treats the input request text as a 
hexadecimal string and converts it to a byte array.  
Conversely it reads a byte array and converts it to a hexadecimal string.

b) The TCPClient has been extended to support the following new methods:
void write(OutputStream os, byte[] b);
byte [] readLengthPrefixed(InputStream is); 
The readLengthPrefixed method expects the first 2 bytes from the stream to 
contain the length (binary) of data to follow and reads this number of 
subsequent bytes returning a byte array containing both the length and data 
bytes.

e.g. 
Request/Response String: 
"002d482d2d2d3e454e414320544350495020484541525420424541543c2d2d2d5443504449414c2056312e30312020"
 
Input/Output Byte Array: [0x00,0x2d, 0x48, ......, 0x20]

This is a simple but limited approach, it does not permit the transmission of 
non-length prefixed binary data nor does it support length prefixed character 
data.  Finally as it is implemented the length prefix must be input as two byte 
binary (input as hexadecimal string) rather than being calculated or input as 
character decimal. 

There are options to make the solution more flexible but before spending time 
on these we would like to know whether the minimal approach taken above would 
be considered for inclusion in a future JMeter release?

Thanks,
Oghie.   





 
**********************************************************************
 
E-mail disclaimer
FEXCO Dynamic Currency Conversion Limited, registered in Ireland, No. 246289. 
Registered Office: FEXCO Centre, Iveragh Road, Killorglin, Co. Kerry.
 
This message, including any attachments, is confidential. If you are not the 
named recipient, please contact the sender and delete the email from your 
system.
 
**********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to