while(runServer) {
uint8_t query[MODBUS_RTU_MAX_ADU_LENGTH];
rc = modbus_receive(mb, query);
if (rc != -1) {
modbus_reply(mb, query, rc, mm);
}
}
I use the runServer boolean to control when it needs to run, the only issue I am having is that when there is no client polling this server, the code stalls at modbus_receive(), therefore not checking while(runServer) and exiting the loop if needed. How could I put some sort of timeout on modbus_receive() so that if it doesn't get a query for a certain amount of time to go ahead and process the loop again and recheck while(runServer)?
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes libmodbus.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .