|
|
4 лет назад | |
|---|---|---|
| .. | ||
| main | 4 лет назад | |
| CMakeLists.txt | 4 лет назад | |
| Makefile | 4 лет назад | |
| README.md | 4 лет назад | |
| example_test.py | 4 лет назад | |
| sdkconfig.ci | 4 лет назад | |
| sdkconfig.defaults | 4 лет назад | |
(See the README.md file in the upper level 'examples' directory for more information about examples.)
The application aims to demonstrate a simple use of Asio library in different modes. In project settings it could be configured to run either a Asio chat server, a Asio chat client, or both.
The example is configured by default as an Asio chat client.
Note that the example uses string representation of IP addresses and ports.
You can find the upstream asio chat implementation [here] https://github.com/chriskohlhoff/asio/tree/master/asio/src/examples/cpp11/chat
In the client mode, the example connects to the configured address, sends the message, which was inserted as an input in the terminal, and receives a response.
In the server mode, Asio chat server with a specified port number is created and being polled till a connection request from the client arrives. Chat server echoes a message (received from any client) to all connected clients.
idf.py menuconfig
Set following parameters under Example Configuration Options:
Set EXAMPLE_CHAT_SERVER to use the example as an ASIO chat server
EXAMPLE_CHAT_SERVER_BIND_PORT to the port number.Set EXAMPLE_CHAT_CLIENT to use the example as an ASIO chat client
EXAMPLE_CHAT_CLIENT_CONNECT_ADDRESS to a string representation of the address to connect the client to.EXAMPLE_CHAT_CLIENT_CONNECT_PORT to the port number.Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in examples/protocols/README.md for more d etails.
idf.py -p PORT flash monitor to build and upload the example to your board and connect to it's serial terminal.nc IP PORT and type for example 4ABC<CR> to transmit 'ABC\n'idf.py -p PORT flash monitor to build and upload the example to your board and connect to it's serial terminal.See the README.md file in the upper level 'examples' directory for more information about examples.