PING kills LoPy after a successful HTTP request to a server
-
Using socket to connect to an HTTP server, then closing the socket, the LoPy keeps going just fine, until I simply ping the LoPy's IP address. It returns a single ICMP reply then crashes.
The firmware is the most recent version to date. Am I doing something wrong?
Thanks,
UldeHere's the code:
import os
from machine import UART
uart = UART(0, 115200)
os.dupterm(uart)import os
import network
from network import WLAN
import socket
import timeWLAN_SSID = 'myssid'
WLAN_SEC = WLAN.WEP
WLAN_KEY = '456c7***********726461'wlan = WLAN(mode=WLAN.STA)
wlanconnectingtime = time.time()
wlan.connect(WLAN_SSID, auth=(WLAN_SEC, WLAN_KEY), timeout = 10000)
while not wlan.isconnected():
time.sleep_ms(50)
print(wlan.ifconfig())
print(os.uname())s = socket.socket()
s.connect(socket.getaddrinfo("google.com", 80)[0][-1])
s.write(b"GET / HTTP/1.0\r\n\r\n")
print(s.read(4096))
s.close()
print('CLOSED')while True:
print(time.time())
time.sleep(1)The terminal dump:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
...
entry 0x4009fc9c
('192.168.0.52', '255.255.255.0', '192.168.0.1', '192.168.0.1')
(sysname='LoPy', nodename='LoPy', release='1.9.2.b2', version='v1.8.6-796-g489fafa0 on 2017-10-15', machine='LoPy with ESP32', lorawan='1.0.0')
b'HTTP/1.0 302 Found\r\nCache-Control: private\r\nContent-Type: text/html; charset=UTF-8\r\nReferrer-Policy: no-referrer\r\nLocation: http://www.google.it/?gfe_rd=cr&dcr=0&ei=BFn_WfKtI9Pw8Aet_pWgAQ\r\nContent-Length: 268\r\nDate: Sun, 05 Nov 2017 18:31:32 GMT\r\n\r\n<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">\n<TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF="http://www.google.it/?gfe_rd=cr&dcr=0&ei=BFn_WfKtI9Pw8Aet_pWgAQ">here</A>.\r\n</BODY></HTML>\r\n'
CLOSED
2
3
4
5
6
7And the ping "killer":
$ ping 192.168.0.52
PING 192.168.0.52 (192.168.0.52): 56 data bytes
64 bytes from 192.168.0.52: icmp_seq=0 ttl=255 time=6.143 ms
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
^C