Arduino: Update WiFiClient example

Created on 4 Jan 2018  路  6Comments  路  Source: esp8266/Arduino

WiFiClient example shows how to send an HTTP request to Sparkfun Data service. However, this service has been discontinued. Some users attempt to use WiFiClient example as a base when implementing HTTP client functionality, which is suboptimal because there are better libraries for that purpose (ESP8266HTTPClient).

Need to develop a new WiFiClient example which will not use a discontinued service, and would not demonstrate something that is not considered best practice.

One possible solution might be to replace WiFiClient example with WiFiClientBasic. In this case, it has to be extended with instructions on setting up a TCP server (e.g. using a GUI tool like Processing and using something like nc for command line).

examples help wanted code cleanup enhancement

All 6 comments

Why not just making a Quine by reading and printing a small page that we know will live not shorter than the sketch ? This one:

http://raw.githubusercontent.com/esp8266/Arduino/master/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino

...The bad news is github serving https only :disappointed:

That would be a nice example for HTTPClient library.

http://www.iana.org/ will always be there... they're the root of DNS. :)

Without asking the user to setup a TCP server (it's hard in Windows), there are limited choices for non-HTTP TCP servers.

A drawback is that the ESP8266 cannot send anything, but is receive-only.

Then what about a WiFiClientBasic example:

  • sending "hello"
  • reading back data
  • using by default quote of the day (only once, we want the service to stay alive :)
  • having some included comments explaining how to use nc for the sent "hello" to be displayed, for windows and unix

Some kind of loopback might be nice then you can see the http in the same code file as you expect to receive from client.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rudydevolder picture rudydevolder  路  3Comments

dariopb picture dariopb  路  3Comments

treii28 picture treii28  路  3Comments

tttapa picture tttapa  路  3Comments

Geend picture Geend  路  3Comments