Comments (3)
Which loop? Could you send me your modified code?
Do you use the new the tarball for v2.9.3?
from libmodbus.
I have used the tarball v2.9.3. To pass all the test cases, I have modified for loop in the unit-test-server.c to flush data. please find the snippet of code for reference, i have also marked "modbus_flush" function in bold.
for (;;) {
rc = modbus_receive(ctx, -1, query);
if (rc == -1) {
/* Connection closed by the client or error */
break;
}
/* Read holding registers */
if (query[header_length] == 0x03) {
if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 3)
== UT_REGISTERS_NB_POINTS_SPECIAL) {
printf("Set an incorrect number of values\n");
MODBUS_SET_INT16_TO_INT8(query, header_length + 3,
UT_REGISTERS_NB_POINTS);
} else if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 1)
== UT_REGISTERS_ADDRESS_SPECIAL) {
modbus_reply_exception(ctx, query,
MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY);
continue;
}
}
rc = modbus_reply(ctx, query, rc, mb_mapping);
if (rc == -1) {
break;
}
modbus_flush(ctx);
- Hide quoted text -
}
from libmodbus.
OK, it's just a workaround but unit tests contain many strange things on purpose so I don't want to hide them with this call.
I don't have the problem on my computer so could you post at least 25 lines of history of server/client tests (github offers a pastebin like). Did you use TCP tests on localhost?
from libmodbus.
Related Issues (20)
- Connection not bindig HOT 1
- CRC Check Error and Slave not the requested One, Ignored
- modbus-tcp协议:ERROR Resource temporarily unavailable HOT 1
- Possible issue due to different library versions : modbus_receive_confirmation() is not useful
- incorrect type to store socket on Windows
- [Project] CLA processing is laggy (want to upstream support for Modbus over USB) HOT 5
- modbus rtu slave on ubuntu 20.04.3
- Setting the coil address to 0 as 1 will immediately be set to 0
- Multiple processes running concurrently using libmodbus over Modbus-Rtu HOT 5
- Why not merge modbus_flush() directly into functions such as modbus_write(read)_xxx() function?
- Missing documentation of `errno` values corresponding to Modbus exception codes HOT 2
- Behaviour of MODBUS_ERROR_RECOVERY_LINK HOT 4
- Broken pipe after Modbus TCP/RTU gateway reboot HOT 3
- With TCP, `modbus_connect()` returns -1 on timeout but does not set `errno`
- facing crash in libmodbus library
- Multiple slaves on the same port. HOT 1
- modbus_rtu_set_serial_mode needs additional flags HOT 1
- heap-buffer-overflow in in `modbus_write_bits` HOT 1
- Invalid CRC HOT 4
- Handling Multiple Slave Addresses with libmodbus on a Single Interface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libmodbus.