Wio Wi-Fi Client Example Code not functioning

In Wi-Fi - Seeed Wiki
the WifI Client example code is not functioning —
code: client.print(“GET /index1.html HTTP/1.1\n\n”);
gives server response: “GET /index1.html HTTP/1.1\n” 400,
so it is sending the last \n instead a stripping it, so remove last \n
and get the same response: “GET /index1.html HTTP/1.1\n” 400,
remove all the \n and the server receives no request
follow the print with a client.flush() and still the server receives no request.
replace the print with write( buf*, size) and still the server receives no request.
What is wrong here???

I have been playing with my Wio Terminal for a little while (implemented a clock using NTP), and I was able to get the Wiki’s Wi-Fi Example Code to work.

I am assuming you have followed instructions to update the latest firmware on RTL8720 as shown in the XIAO Terminal Network overview.

Now…

To see whether your problem is a system problem (Firewall or some other settings problem) I suggest the following (tested on my Windows 10 workstation):

Use ipconfig to find your workstation’s IPv4 address. (My workstation IP address happens to be 192.168.1.115)

Follow the instructions about creating index.html.
The contents of my (slightly different) index.html file are this:

<html>
<body>
Hi, Dave!
</body>
</html>

Leave the Windows command window open at the directory where you created the index.html

Execute the Python command to start the http server and you should see something like the following

Serving HTTP on :: port 80 (http://[::]:80/) ...

Open a browser (I tested with Firefox and Microsoft edge)

Enter your workstation’s IPv4 address in the browser’s address window.

The browser should show the stuff between < body> and < /body> in your index.html (The first attachment below is from Firefox.)

The Windows Command window should show something like this:

::ffff:192.168.1.115 - - [13/Aug/2022 06:56:25] "GET / HTTP/1.1" 200 -

If this works, then you are ready for the Arduino sketch.

I copied the Client Example Code from Wi-Fi - Seeed Wiki

I made the following changes:

I changed the ssid and password strings to my password and ssid
I changed the host string near the top of loop() to my workstation IP Address.

Now when I ran the sketch, the Arduino Serial Monitor window showed the following each time through the loop (Second attachment below)

Connecting to 192.168.1.115
HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.9.1
Date: Sat, 13 Aug 2022 14:45:33 GMT
Content-type: text/html
Content-Length: 47
Last-Modified: Sat, 13 Aug 2022 13:55:14 GMT

<html>
<body>
Hi, Dave!
</body>
</html>


Closing connection.
Waiting 5 seconds before restarting...

and the Windows Command Window showed the following each time through the loop (Third attachment below):

:ffff:192.168.1.221 - - [13/Aug/2022 06:57:40] "GET /index.html HTTP/1.1" 200 -

Regards,

Dave

FirefoxWindow

WindowsCommandWindow

ClientDemo.zip (49.1 KB)

1 Like