TCP Sampler in JMeter - tcp

I am using TCP Sampler in JMeter. The data being sent is in the HEX format (45 00 0F CD 04 39 40 00)and JMeter is unable to process the data. On execution, JMeter throws a read exception.
The Read Exception obtained is : meter.protocol.tcp.sampler.TCPSampler: org.apache.jmeter.protocol.tcp.sampler.ReadException: at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:117)
Please guide me on the same if anyone of you have used TCP Sampler.

Try to send your data without spaces 45000FCD04394000, and check if you use TCP Sampler properly in order with instructions from http://jmeter.apache.org/usermanual/component_reference.html#TCP_Sampler

Related

Is it possible for a certain sequence of data bytes to drop a TCP connection

I have a simple TCP client/server arrangement (running on Windows 10/11) used to transfer binary data from multiple remote clients to a single server. This works 99% of the time. However, whenever the following hexadecimal sequence appears in the data (being sent from the client to the server) the TCP connection drops and the client generates a 10053 error.
6C 74 01 00 08 00 00 00
Running the server application on a local network has slightly different results... the connection does not drop but the client receives no ACK from the server.
Is it possible for a certain sequence of bytes to drop, or otherwise interfere with, a TCP connection?

LORA Sx1276 send same response in every condition

I am usign one of Dorji's pruduct. The products name is DRF1276DM. The image of the product can seen in following images
In the application note the producers state that the module can communicate over serial port with TTL level UART. In their application note which can be found at http://www.dorji.com/docs/data/DRF1278DM.pdf. They state that if we send a command like AF AF 00 00 AF 80 03 02 00 00 92 0D 0A the device will response as AF AF 00 00 AF 00 03 02 00 00 12 0D 0A I try to check this command in order to test the device but I receive same command in my all trial. The device send me that 2400 O 8 1 DRF128X V2.7. In the application note they state that the device will send only one time this command when power is one but In my case the response is always same regardless to command code.
For checking the condition I try to use every command on http://www.dorji.com/docs/data/DRF1278DM.pdf but I recieved same respond. My first question is this. Are there any one who deal with same problem with me or could you give me any solution for this case. I am suspicious that the device get reset in every time when I try to send command over serial port. Is there any way to reset the device to default either using software or hardware.
In the application note they state that the first respond which I quoted above, will give the information for communcating device In our case I expected to communicate with device on odd parity 8 bit data size 2400 baud rate but the device only gives irrelevant or nonlogical bytes in 2400 baud rate. Only logical answer I received from device is on the 9600 baud rate. My second question is this. Is there a bug on this device setting or did I miss someting because as far as I know we cannot communicate with devices over multiple baud rate option.
PS:
I try to use their configuration tool which can be found in http://www.dorji.com/products-detail.php?ProId=61, but I got same "time out"
Error from device, I used 2400 boud rate and even parity but the result cannot changed.
Pin EN must be connected to logical 0
Firstly, the Error Time Out error appears because of a damaged UART-to-USB converter or this happens when you are using multiple jumper wires for a single pin of the module. Try using the a single female-to-female jumper wire to connect every pin of your module with the corresponding pin of the UART-to-USB converter.
Your UART is probably working fine, i have the same issues.
My DRF1278/76 modules dont seem to respon to me changing the baudrate in configuration parameters, it looks like its fixed to 9600 bauds, wich is a boomer
I had this problem too, my issue was the EN pin needs to be pulled low. Even with the USB to UART adapter I bought with the modules, that line is allowed to site high by default. Use a jumper to pull it to ground.

use serialforwarder data in another program

how can i build the serialforwarder or use it to forward the received data to another program to make some process?
how to parse the data and use it as input data to another program such as Matlab or c# or java application.
which protocol used to parse the recieved data ?
last question: it is just for motes which is base station mote ? can i build one for any mote ?
You have to read thoroughly the serial stack...its not very easy but its do able.
You can directly read from serial port. You don't need serial forwarder in this case. There are few things to take care of.
For example if you want to read a serial message that is being send to serial port of your PC (usb sensorboards just work like serial, since they are using usb to serial converters lik FTDI chip).
in C# (same for Java, etc...) you can read byte streams that are coming in the serial port. You can parse this byte streams to extract a standard serial message of tinyos.
This is somehow explained in TEP #113 although it has some problems, but you should be able to find those problems and make your program work.
As it stated in TEP 113, a standard serial packet is something like:
7e 40 09 00 be ef 05 7d 5d 06 01 02 03 04 05 7e
That means, a packet starts with hex 7E ( I believe its 126 or 127) and ends also with 7E. The last 2 bytes are CRC of the packet. So you can in your c# program start reading from serial port when you encounter 7E and stop reading when you reach the next 7E in the stream. Everything in between will be your packet.
You have to be careful of escaping that is if a 7E is part of your packet content, to be not be confused with start and end dilimeters, it will be escaped to something else...that's also is explained in that TEP 113.
I believe there were some C++ code fro calculating the CRC that you can easily convert it to C# or Java code.
Also check the source code of Serial.h which contains some details about how a serial packet is being formed in TinyOS.

how tcp stack distinguish close and shutdown?

As we known that:
/////////////////////////////////////////////////////////
close() will terminate both directions on a tcp connection
shutdown() can block communication in one or both directions
/////////////////////////////////////////////////////////
here,what puzzled me is how tcp stack can tell them apart?
I have write an example program:
firstly I use :
....
connect(192.168.1.100) //there is a server process running in 192.168.1.100
....
close(socketfd);
sleep(1000);
then I use wireshark to dump the packets:
01 -->syn
02 <--syn,ack
03 -->ack
04 -->fin,ack
05 <--ack
netstat -an |grep 192.168.1.100
I have run it for about 5 minutes, it print:
"tcp 0 0 ... FIN_WAIT2 " at first,then after about 2 minutes there is no output,seems that the connection has been destroyed.
then, I use :
....
connect(192.168.1.100)
....
shutdown(socketfd,SHUT_WR);
sleep(1000);
use wireshark to dump the packets:
01 -->syn
02 <--syn,ack
03 -->ack
04 -->fin,ack
05 <--ack
...
netstat -an |grep 192.168.1.100
run it for about 10 minutes, it always print:
"tcp 0 0 ... FIN_WAIT2"
from the output of wireshark ,it seems there is no different for close and shutdown,
but from the output of netstat ,its behaviour is different.
so why the behaviour is different?
There is no difference on the wire between just closing the socket and doing shutdown(SHUT_RDWR). Either will cause the TCP stack to emit a FIN and stop accepting packets from the other end. The only difference is in your program: after shutdown the file descriptor remains valid, but after close it doesn't. To be sure, you cannot do much with the still-valid file descriptor after shutdown besides closing it, but it is valid nonetheless.
In your case you use SHUT_WR, not SHUT_RDWR, so your socket is still prepared to receive data from the other end. But your server doesn't send any data. You would see a difference between close and shutdown(SHUT_WR) if your server sent some data after the client had closed its end. The close() client would respond to the server's data with RST whereas the shutdown(SHUT_WR) client would accept the server's data and ACK it. A shutdown(SHUT_RDWR) client would behave the same as the close() client.
In most client-server TCP protocols (like HTTP for instance), the server will terminate its end of the connection anyway as soon as it receives a FIN from the client. So with those protocols it doesn't make much of a difference whether the client half-closes or full-closes the socket because the server will promptly close its end of the connection anyway. I can see that your server does not behave like this though, because I don't see it sending its own FIN (only your client sends a FIN).

How to send Ctrl+z with gprs module

i want to send a picture with GPRS module and through a TCP connection to a server.
but my picture contains some "1a" (CTRL+Z) value in some bytes. As we know this is the terminator character for sending sms or data with AT commands. how can I send ctrl+z as a byte of data ?
Also when sending process reaches to character \0, it stops and returns an error. I mean GPRS module sends ERROR to serial port.
Example:
FF D8 FF E0 00 10
FF and D8 and FF and E0 will send successfully but error occurred at 00.
what is the problem?
thanks.
I was working on a project to sen sms from pc using AT Commands. Here I was using following command for ctrl+z.
outputStream.write(26);
Try sending 0x1A, or $1A if that doesn't work type $1A.

Resources