forked from andresarmento/modbus-esp8266
-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Milestone
Description
Dear All,
I am trying to use this library with STM32. So far, I found that STM32Ethernet has some differences to Arduino Ethernet. In the earlier, accept() is a private function, so we have to call available() instead at this point of ModbusTCPTemplate.h:
while (millis() - taskStart < MODBUSIP_MAX_READMS && (c = tcpserver->available())) {
The issue I am facing now is that the code only comes out of this while with data when the TCP connection is closed (and tcpserver becomes not available).
The solution I found so far was to change the continue keyword to break down in the code, once the tcpclient[n] has been assigned with the currentClient
if (n > -1) {
tcpclient[n] = currentClient;
BIT_SET(tcpServerConnection, n);
#if defined(MODBUSIP_DEBUG)
Serial.print("IP: Conn ");
Serial.println(n);
#endif
break; // (BREAK INSTEAD OF CONTINUE while
}
Is this an acceptable solution? Is there any better one?
Best regards,
Tomas