Enable lwip non-blocking mode in ard_socket.c #112
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
lwip_fcntl(_sock, F_SETFL, O_NONBLOCK);
instart_server()
andstart_server_v6()
to enable lwip non-blocking mode.Remarks
**Thanks for Ameba Arduino user @jojoling's help with raising this bug and providing the solution.
How to reproduce this bug?
Add in any code after WiFiWebServer.ino line 89: (For example:
Serial.println("abc");
)**https://github.com/ambiot/ambd_arduino/blob/2e8a9df1f8a297cc643e858b42204908e391addf/Arduino_package/hardware/libraries/WiFi/examples/WiFiWebServer/WiFiWebServer.ino#L89
After the example is uploaded to the board and running, while no client is connecting to the Ameba board, the added line will never be able to be printed in the serial monitor.
Provided solution
This is due to lwip's default running in "blocking" mode. Adding
lwip_fcntl(_sock, F_SETFL, O_NONBLOCK);
instart_server()
andstart_server_v6()
to enable lwip non-blocking mode.