This is a quick example of a simple HTTP client program using the network-socket API that is provided as a part of mbed-os. The program brings up an underlying network interface, and uses it to perform an HTTP transaction over a TCPSocket.

Committer:
mbed_official
Date:
Wed Oct 26 12:00:09 2016 +0100
Revision:
0:17bd84fc5087
Child:
5:3e952c60d705
Initial commit
Commit copied from https://github.com/ARMmbed/mbed-os-example-sockets

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:17bd84fc5087 1 ### Getting started with the network-socket API ###
mbed_official 0:17bd84fc5087 2
mbed_official 0:17bd84fc5087 3 This is a quick example of a simple HTTP client program using the
mbed_official 0:17bd84fc5087 4 network-socket API that is provided as a part of [mbed-os](github.com/armmbed/mbed-os).
mbed_official 0:17bd84fc5087 5
mbed_official 0:17bd84fc5087 6 The program brings up an underlying network interface, and uses it to perform an HTTP
mbed_official 0:17bd84fc5087 7 transaction over a TCPSocket.
mbed_official 0:17bd84fc5087 8
mbed_official 0:17bd84fc5087 9 ### Ethernet ###
mbed_official 0:17bd84fc5087 10
mbed_official 0:17bd84fc5087 11 By default, the example should use the ethernet interface available on the board. Simply
mbed_official 0:17bd84fc5087 12 compile, flash, and run.
mbed_official 0:17bd84fc5087 13
mbed_official 0:17bd84fc5087 14 ### WiFi ###
mbed_official 0:17bd84fc5087 15
mbed_official 0:17bd84fc5087 16 To enable WiFi, you will need an [esp8266](https://developer.mbed.org/teams/ESP8266/).
mbed_official 0:17bd84fc5087 17 To enable WiFi in the example, you will need to define three defines during compile time.
mbed_official 0:17bd84fc5087 18
mbed_official 0:17bd84fc5087 19 ``` bash
mbed_official 0:17bd84fc5087 20 -DMBED_DEMO_WIFI # enables wifi
mbed_official 0:17bd84fc5087 21 -DMBED_DEMO_WIFI_SSID=ssid # ssid
mbed_official 0:17bd84fc5087 22 -DMBED_DEMO_WIFI_PASS=pass # passphrase
mbed_official 0:17bd84fc5087 23 ```
mbed_official 0:17bd84fc5087 24
mbed_official 0:17bd84fc5087 25 ### Documentation ###
mbed_official 0:17bd84fc5087 26
mbed_official 0:17bd84fc5087 27 More information on the network-socket API can be found in the [mbed handbook](https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/communication/network_sockets/).