diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-26 00:59:21 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-04-26 00:59:30 +0300 |
commit | c88883141072cbc2efc9e4af2115d64423f4f89f (patch) | |
tree | 8d3c0449cd32a9805c97cf4a0a52fd9f3a58f101 /esp8266/scripts | |
parent | 29c8c8aecb3409e57a43256f8fe5cb25de1e9856 (diff) | |
download | micropython-c88883141072cbc2efc9e4af2115d64423f4f89f.tar.gz micropython-c88883141072cbc2efc9e4af2115d64423f4f89f.zip |
esp8266/scripts/webrepl: Print connection address.
Based on active network interfaces.
Diffstat (limited to 'esp8266/scripts')
-rw-r--r-- | esp8266/scripts/webrepl.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/esp8266/scripts/webrepl.py b/esp8266/scripts/webrepl.py index e837e760d3..df742408da 100644 --- a/esp8266/scripts/webrepl.py +++ b/esp8266/scripts/webrepl.py @@ -1,6 +1,7 @@ # This module should be imported from REPL, not run from command line. import socket import uos +import network import websocket import websocket_helper @@ -13,13 +14,15 @@ def setup_conn(port): listen_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ai = socket.getaddrinfo("0.0.0.0", port) - print("Bind address info:", ai) addr = ai[0][4] listen_s.bind(addr) listen_s.listen(1) listen_s.setsockopt(socket.SOL_SOCKET, 20, accept_conn) - print("WebREPL daemon started on port %d" % port) + for i in (network.AP_IF, network.STA_IF): + iface = network.WLAN(i) + if iface.active(): + print("WebREPL daemon started on %s:%d" % (iface.ifconfig()[0], port)) def accept_conn(listen_sock): |