The port is shown reliably in the LIST
output:
per@HAL MINGW64 ~/AppData/Local/Arduino15/packages/builtin/tools/mdns-discovery/1.0.6
$ ./mdns-discovery.exe
HELLO 1 "arduino-cli 0.21.0"
{
"eventType": "hello",
"message": "OK",
"protocolVersion": 1
}
START
{
"eventType": "start",
"message": "OK"
}
LIST
{
"eventType": "list",
"ports": [
{
"address": "192.168.254.130",
"label": "esp8266-880a45 at 192.168.254.130",
"protocol": "network",
"protocolLabel": "Network Port",
"properties": {
".": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"auth_upload": "no",
"board": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"hostname": "esp8266-880a45.local.",
"port": "8266",
"ssh_upload": "no",
"tcp_check": "no"
}
}
]
}
STOP
{
"eventType": "stop",
"message": "OK"
}
START
{
"eventType": "start",
"message": "OK"
}
LIST
{
"eventType": "list",
"ports": [
{
"address": "192.168.254.130",
"label": "esp8266-880a45 at 192.168.254.130",
"protocol": "network",
"protocolLabel": "Network Port",
"properties": {
".": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"auth_upload": "no",
"board": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"hostname": "esp8266-880a45.local.",
"port": "8266",
"ssh_upload": "no",
"tcp_check": "no"
}
}
]
}
LIST
{
"eventType": "list",
"ports": [
{
"address": "192.168.254.130",
"label": "esp8266-880a45 at 192.168.254.130",
"protocol": "network",
"protocolLabel": "Network Port",
"properties": {
".": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"auth_upload": "no",
"board": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"hostname": "esp8266-880a45.local.",
"port": "8266",
"ssh_upload": "no",
"tcp_check": "no"
}
}
]
}
LIST
{
"eventType": "list",
"ports": [
{
"address": "192.168.254.130",
"label": "esp8266-880a45 at 192.168.254.130",
"protocol": "network",
"protocolLabel": "Network Port",
"properties": {
".": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"auth_upload": "no",
"board": "\\\"ESP8266_NODEMCU_ESP12E\\\"",
"hostname": "esp8266-880a45.local.",
"port": "8266",
"ssh_upload": "no",
"tcp_check": "no"
}
}
]
}
STOP
{
"eventType": "stop",
"message": "OK"
}
QUIT
{
"eventType": "quit",
"message": "OK"
}
I ran the command quite a few additional times without ever getting an empty ports
array.