-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP client ESP32 loses information depending on delay #262
Comments
I suspect that you are flooding write requests from sender side. For the first try do not sent next request until get response on previous one. Something like: uint32_t trans = 0;
void loop() {
if (!mb.isTransaction(trans)) {
trans = mb.writeHreg(...);
}
mb.task();
} |
Thanks for the quick response, It worked I made the change on the client:
agora está funcionando bem. Mas estou com algumas dúvidas se preciso fazer vários Read Register do mesmo remote(IP) precisa ser feito (acho que não):
Or I just need to do isTransaciton with only one remote information instead of all? Thank you very much in advance |
Indeed uint16_t trans = mb.readHreg(remote, REG, &res);
uint16_t trans1 = mb.readHreg(remote, REG1, &res1);
// <- at this point requests just dent to remote and no response data in res and res1 yet
while (mb.isTransaction(trans) || mb.isTransaction(trans1)) { // Wait transactions to complete
mb.task();
}
// <- Only at this point you have res and res1 filled by returned data
Serial.print("Receive:");Serial.println(res);
Serial.print("Receive1:");Serial.println(res1); |
OK thank you |
It looks like I'm suffering the same thing here, only now I'm using a TCP simens s71200 client(Write) and ESP32 server(Read) I am doing TPC communication between a PLC and an ESP32, I would like to know if there is any way to improve communication because sometimes the ESP keeps showing the repeated value, it varies from 2 seconds to 10 seconds, then it returns to normal Does it have something like Transactional.ino for the server? I'm using: if I request the IP of the CLP in mb.readHreg(.....) I can't communicate with it just using mb.Hreg and I also tried to change the ESP to client and read the client PLC but it didn't work |
hi,
I am testing TCP/IP communication between two ESP32s, one being the server (send the Hreg Register) the other the client (will receive the Hreg Register) the information it is sending is a random number from 0 - 2000.
when performing this test I verified that depending on the delay in mb.task(); it varies the transmission speed, so I did a test with the 100ms delay and noticed that the reading losses by the client are huge and can reach 6 seconds (repeatedly showing the last number that was received) as can be seen in the video on the left the server(COM7) and on the right the client(COM5).
100MS.mp4
I performed a test with 250ms/500ms and this loss decreased but it still exists (in the video I only test it with 250ms).
250MS.mp4
then I performed the tests with 800ms and until it worked well.
800MS.mp4
So with that I would like to know if there is any way to send information with a delay of around 500ms without this loss happening, I believe that this loss comes from reading the ESP32 client because I have tested the ESP32 server with a simulator CLIENT on pc in 100ms and it worked great.
100MS_simulator.mp4
and also if I leave the client's delay smaller than the server's, the same information loss behavior occurs. I know that 100ms is a very high speed, but I would like at least 500ms works fine.
The text was updated successfully, but these errors were encountered: