Still empty.
Code: Select all
>>> socket.getaddrinfo('http://micropython.org', 80)
[]
As I suspected if I connect to WLAN is working:
>> socket.getaddrinfo('micropython.org', 80)
[(2, 1, 0, 'micropython.org', ('176.58.119.26', 80))]
Code: Select all
>>> wlan.connect('SSID', '******') # connect to an AP
>>> I (319901) wifi: new:<2,0>, old:<1,0>, ap:<255,255>, sta:<2,0>, prof:1
I (320751) wifi: state: init -> auth (b0)
I (320751) wifi: state: auth -> assoc (0)
I (320761) wifi: new:<2,1>, old:<2,0>, ap:<255,255>, sta:<2,1>, prof:1
I (320761) wifi: state: assoc -> run (10)
I (320771) wifi: connected with SSID, channel 2, 40U, bssid = 14:22:33:e8:39:d8
I (320771) wifi: pm start, type: 1
I (320781) network: CONNECTED
I (320831) wifi: new:<2,0>, old:<2,1>, ap:<255,255>, sta:<2,0>, prof:1
>>>
>>>
>>> I (323261) event: sta ip: 192.168.89.5, mask: 255.255.255.0, gw: 192.168.89.1
I (323261) network: GOT_IP
>>> gsm.disconnect()
I (351441) [PPPOS CLIENT]: Disconnect requested.
W (351481) [PPPOS CLIENT]: status_cb: User interrupt (disconnected)
I (352581) [PPPOS CLIENT]: AT COMMAND: [AT..]
I (352601) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (352601) [PPPOS CLIENT]: Disconnected.
True
>>>
>>>
>>> socket.getaddrinfo('micropython.org', 80)
[(2, 1, 0, 'micropython.org', ('176.58.119.26', 80))]
If I try to disconnect from WLAN and connect back to gsm:
Code: Select all
>>> wlan.disconnect()
>>> I (896081) wifi: STA_DISCONNECTED, reason:8
>>> gsm.connect()
I (912101) [PPPOS CLIENT]: Reconnect requested.
I (912101) [PPPOS CLIENT]: GSM initialization start
I (912701) [PPPOS CLIENT]: AT COMMAND: [AT..]
...
I (915711) [PPPOS CLIENT]: GSM initialized.
I (916601) [PPPOS CLIENT]: status_cb: Connected
I (916601) [PPPOS CLIENT]: ipaddr = 10.4.93.171
I (916601) [PPPOS CLIENT]: gateway = 192.168.254.254
I (916611) [PPPOS CLIENT]: netmask = 255.255.255.255
I (916611) [PPPOS CLIENT]: ip6addr = ::
>>> socket.getaddrinfo('google.com', 80)
[]
>>> socket.getaddrinfo('micropython.org', 80)
[(2, 1, 0, 'micropython.org', ('176.58.119.26', 80))]
>>> socket.getaddrinfo('google.com', 80)
[]
>>> I (1016081) event: station ip lost
I (1016081) network: event 8
>>> addr = socket.getaddrinfo('172.217.16.110', 80)[0][-1]
>>> s = socket.socket()
>>> s.connect(addr)
>>> s.send(b'GET / HTTP/1.1\r\nHost: google.com\r\n\r\n')
36
>>> data = s.recv(1000)
>>> print(data)
b'HTTP/1.1 301 Moved Permanently\r\nLocation: http://www.google.com/\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Sat, 29 Aug 2020 13:21:03 GMT\r\nExpires: Mon, 28 Sep 2020 13:21:03 GMT\r\nCache-Control: public, max-age=2592000\r\nServer: gws\r\nContent-Length: 219\r\nX-XSS-Protection: 0\r\nX-Frame-Options: SAMEORIGIN\r\n\r\n<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">\n<TITLE>301 Moved</TITLE></HEAD><BODY>\n<H1>301 Moved</H1>\nThe document has moved\n<A HREF="http://www.google.com/">here</A>.\r\n</BODY></HTML>\r\n'
>>> s.close()
If I connect to WIFI this is working...any idea how I could make this work by only using my "gsm" custom module. The module is an external C module...
Thanks.