WiFiServer broken in 3.1.6

Arduino SDK version: 3.1.6
Build Environment: Arduino 1.8.19 / macOS Big Sur
Board: BW16

Prerequisites: Update binary to postbuild for BigSur

Reproduce steps:

  1. Open Arduino
  2. Open SimpleServerWiFi
  3. Update ssid/password
  4. Build and Upload
  5. Restart BW16 and wait for wifi connection
  6. Use ping to check TCP connection and it works
  7. test command for webserver: curl -v http://bw16ip:5000/
    Expect: curl returns the http connect logs
    Actual: curl returns error Received HTTP/0.9 when not allowed

I also tried to use curl --http0.9 -v http://bw16ip:5000/ and I got

*   Trying
* Connected to ( port 5000 (#0)
> GET /d HTTP/1.1
> Host:
> User-Agent: curl/7.87.0
> Accept: */*
GET /d HTTP/1.1
User-Agent: curl/7.87.0
Accept: */*

then it was blocked and did not return

I have my code for the same board works totally fine in 3.1.2

cc @wyy @QQZ

Just found the issue is from the example code , the loop will not be ended when there’s nothing to read.

Hi @Victor,

“curl” command is used to transfer data to or from a server using protocols such as HTTP. However, the example “SimpleServerWiFi” that you are currently running is establishing a TCP transmission for handshake.

You can look at the “SimpleWebServerWiFi” example (HTTP – Set up Server to Control LED – Realtek IoT/Wi-Fi MCU Solutions) for your application. “curl” command was used in this example, and it is working fine.

Thank you.


The point is not about curl or using 0.9 should still work

Please check the source code below:
When the client is connected
Then it will enter the while loop
But the break was set when there’s anything can be read and it can be written out. That makes the loop never break.

I assumed the solution is to break as soon as nothing to read as the loop function will be called after it’s finished.

The WebServer one may not have this issue as it will check if it’s still available before read to ensure the loop will be exited properly.

while (client.connected()) {
        memset(buffer, 0, 256);
        int n = client.read((uint8_t*)(&buffer[0]), sizeof(buffer));
        if (n > 0) {
            for (int i = 0; i < n; i++) {
            n = client.write(buffer, n);
        } else break;


Thank you for pointing out this issue! We will test and update in our SDK dev branch and in future release.