Mbed OS - TCP ping-pong with node.js
Looking for UDP? See mbed-udp-ping-pong.
Tested on ODIN-W2 EVK, but should work on every Mbed OS 5 device that implements the Network Sockets API.
Get both devices on the same WiFi network, or host the server on a publicly available hostname.
Setting up the server
Install a recent version of node.js.
Open a terminal.
Navigate to the
$ node server.js
Note down the IP address of the WiFi interface.
Setting up the client
mbed_app.jsonand set your connectivity method and WiFi credentials.
main.cppand set the IP (or hostname) of the server.
- Compile and flash on the device.
What it does
The Mbed device will set up a TCP socket to the server, and will send 'ping' the server. The server will respond with 'pong'.