README: add information on how to configure

This commit is contained in:
johnny9
2023-05-04 20:10:36 -04:00
parent dc5d75e444
commit c1af662d4e

View File

@@ -2,35 +2,7 @@
| ----------------- | ----- | -------- | -------- | -------- | -------- |
# TCP Client example
(See the README.md file in the upper level 'examples' directory for more information about examples.)
The application creates a TCP socket and tries to connect to the server with predefined IP address and port number. When a connection is successfully established, the application sends message and waits for the answer. After the server's reply, application prints received reply as ASCII text, waits for 2 seconds and sends another message.
## How to use example
In order to create TCP server that communicates with TCP Client example, choose one of the following options.
There are many host-side tools which can be used to interact with the UDP/TCP server/client.
One command line tool is [netcat](http://netcat.sourceforge.net) which can send and receive many kinds of packets.
Note: please replace `192.168.0.167 3333` with desired IPV4/IPV6 address (displayed in monitor console) and port number in the following command.
In addition to those tools, simple Python scripts can be found under sockets/scripts directory. Every script is designed to interact with one of the examples.
### TCP server using netcat
```
nc -l 192.168.0.167 3333
```
### Python scripts
Script example_test.py could be used as a counter part to the tcp-client project, ip protocol name (IPv4 or IPv6) shall be stated as argument. Example:
```
python example_test.py IPv4
```
Note that this script is used in automated tests, as well, so the IDF test framework packages need to be imported;
please add `$IDF_PATH/tools/ci/python_packages` to `PYTHONPATH`.
# ESP-miner
## Hardware Required
@@ -41,18 +13,31 @@ This example can be run on any commonly available ESP32 development board.
```
idf.py menuconfig
```
Set following parameters under Example Configuration Options, these will define the stratum server you connect to:
Set following parameters under Example Configuration Options:
* Set IP version of example to be IPV4 or IPV6.
* Set `IP version` of example to be IPV4 or IPV6.
* Set IPV4 Address in case your chose IP version IPV4 above.
* Set `IPV4 Address` in case your chose IP version IPV4 above.
* Set IPV6 Address in case your chose IP version IPV6 above.
* Set `IPV6 Address` in case your chose IP version IPV6 above.
Set Port number that represents remote port the example will connect to.
Set following parameters under Example Connection Configuration Options:
* Set `WiFi SSID` to your target wifi network SSID.
* Set `Wifi Password` to the password for your target SSID.
For more information about the example_connect() method used here, check out https://github.com/espressif/esp-idf/blob/master/examples/protocols/README.md.
Username is currently hardcoded in miner.c. Modify the defines to change these.
```
#define STRATUM_USERNAME "johnny9.esp"
```
* Set `Port` number that represents remote port the example will connect to.
Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
## Build and Flash
@@ -65,8 +50,3 @@ idf.py -p PORT flash monitor
(To exit the serial monitor, type ``Ctrl-]``.)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
## Troubleshooting
Start server first, to receive data sent from the client (application).