lwIP provides three Application Program's Interfaces (APIs) for programs to use for communication with the TCP/IP code: More...
|Non thread-safe APIs, callback style for maximum performance and minimum memory footprint. |
|Sequential-style APIs, blocking functions. |
|BSD-style socket API. |
lwIP provides three Application Program's Interfaces (APIs) for programs to use for communication with the TCP/IP code:
The raw TCP/IP interface allows the application program to integrate better with the TCP/IP code. Program execution is event based by having callback functions being called from within the TCP/IP code. The TCP/IP code and the application program both run in the same thread. The sequential API has a much higher overhead and is not very well suited for small systems since it forces a multithreaded paradigm on the application.
The raw TCP/IP interface is not only faster in terms of code execution time but is also less memory intensive. The drawback is that program development is somewhat harder and application programs written for the raw TCP/IP interface are more difficult to understand. Still, this is the preferred way of writing applications that should be small in code size and memory usage.
All APIs can be used simultaneously by different application programs. In fact, the sequential API is implemented as an application program using the raw TCP/IP interface.
Do not confuse the lwIP raw API with raw Ethernet or IP sockets. The former is a way of interfacing the lwIP network stack (including TCP and UDP), the latter refers to processing raw Ethernet or IP data instead of TCP connections or UDP packets.
Raw API applications may never block since all packet processing (input and output) as well as timer processing (TCP mainly) is done in a single execution context.