Hello, Background: My embedded device can only handle one connection from a PC and refuses a connection when one is open. To date, I have done this by setting a bool true it the accept callback and setting it to false when the tcp_recv callback indicates the connection is closed. If the accept callback sees the true bool, I send a message back to the PC that the device is already connected and use tcp_close to close the second connection.
Problem: Every once in a very long while, I'm out of sync and the PC connection is refused even though the previous connection has closed. I doubt it's an Ethernet error, and I don't want to assume that there could be an intermittent missed callback to tcp_recv telling me that the connection has closed. So I don't know how this state is entered. In any case, it's a really bad state to wind up in! I have to cycle power to the device to reconnect to it. Question: I'm sure there is a better way to go about doing this. Instead of querying a bool variable that I have to maintain is there an lwIP function that will always work to determine if there is an open connection to a port? I don't mind getting the second connection (briefly) and it has been nice to warn the PC user that someone else is connected to the device. But I need to stay in perfect sync. Thank you, Bill Auerbach _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
