network — network configuration

This module provides network drivers and routing configuration. Network drivers for specific hardware are available within this module and are used to configure a hardware network interface. Configured interfaces are then available for use via the socket module.

For example:

# configure a specific network interface
# see below for examples of specific drivers
import network
nic = network.Driver(...)

# now use socket as usual
import socket
addr = socket.getaddrinfo('', 80)[0][-1]
s = socket.socket()
s.send(b'GET / HTTP/1.1\r\nHost:\r\n\r\n')
data = s.recv(1000)

class WLAN

This class provides a driver for WiFi network processor in the ESP8266. Example usage:

import network
# setup as a station
nic = network.WLAN()
nic.connect('your-ssid', 'your-password')
# now use socket as usual


class network.WLAN

Create a WLAN driver object.


wlan.connect(ssid, password)

Connect to the specified wireless network, using the specified password.


Disconnect from the currently connected wireless network.