The latest development version of this page may be more current than this released 2.2-beta.2 version.

TCP/IP

The WM IoT SDK defaults to using the LWIP protocol stack.

TCP/IP Model

The TCP/IP model of the WM IoT SDK is illustrated in the following diagram:

graph TB A(APP)<-->|"DATA"|B[TCP/IP] B-->|"Event"|C[EV] C-->|"Event"|A E-->|"CMD"|B D[WiFi API]-->|"CMD"|E[WM_NETIF]

The following events are included:

  • WM_EVENT_WIFI_STA_GOT_IP :

    The station has obtained an IPv4 address.

  • WM_EVENT_WIFI_STA_GOT_IP6 :

    The station has obtained an IPv6 address.

  • WM_EVENT_WIFI_STA_LOST_IP :

    The station has lost its IPv4 address.

  • WM_EVENT_WIFI_STA_LOST_IP6 :

    The station has lost its IPv6 address.

  • WM_EVENT_WIFI_AP_STAIPASSIGNED :

    The SoftAP has successfully assigned an IP address to a connected station.

LWIP Protocol Stack

The specific APIs of the LWIP TCP/IP protocol stack in the WM IoT SDK are as follows:

BSD Socket API:

The BSD Socket API is a common cross-platform TCP/IP socket API that originated from the Berkeley Standard Distribution of the UNIX operating system and has now been standardized as part of the POSIX specification.

In the WM IoT SDK, LWIP supports all common usages of the BSD Socket API.

Netconn API:

In the WM IoT SDK, LWIP supports two lower-level APIs, namely the Netconn API and the Raw API:

  • The LWIP Raw API is suitable for single-threaded devices.

  • The Netconn API is used internally by LWIP to implement the BSD Socket API. Compared to the BSD Socket API, this API consumes fewer resources.

Attention

Generally, it is recommended to use the BSD Socket API.

For more information on the Netconn API, please refer to the Unofficial lwIP Application Developer’s Manual .

IPv6:

The WM IoT SDK supports the IPv6 protocol.

Configuring LWIP with WM IoT SDK’s menuconfig

Enter menuconfig using the compile command line, select Components configuration to enter the component configuration and then select LWIP to view the relevant properties related to LWIP, such as:

  • TCPIP task receive mail box size :

    The mailbox size for receiving TCPIP tasks.

  • Maximum number of retransmissions of data segments :

    The maximum number of retransmissions of data segments.

  • Default TCP receive mail box size :

    The default size of the TCP receive mailbox.

  • Enable ipv6 :

    Enable IPv6.