Skip to content

Conversation

@xCENTx
Copy link

@xCENTx xCENTx commented May 18, 2025

This pull request introduces a small but important change to the kmNet_init function in the kmboxNet.cpp file to improve network communication reliability. Specifically, it sets a timeout for receiving data on the socket. This prevents any application using the KMNet library from encountering a threadlock due to a device connection failing.

  • kmboxNet.cpp: Added a SO_RCVTIMEO socket option to set a 3-second timeout for receiving data, ensuring the function does not hang indefinitely if no response is received.

resolved a threadlock issue where no timeout was applied before attempting to establish a connection to the KMNet Device
@ZCban
Copy link
Owner

ZCban commented May 18, 2025

I have never had any missed responses with the initialization when that event occurs to you?

@xCENTx
Copy link
Author

xCENTx commented May 18, 2025

I have never had any missed responses with the initialization when that event occurs to you?

If one were to call kmNet_init with incorrect parameters or the device is not detected the function will fail to return as it hangs on err = recvfrom(sockClientfd, (char*)&rx, 1024, 0, (struct sockaddr*)&addrSrv, &clen);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants