Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
22 years ago

How to use sockets with the Stand-Alone LWIP?

Hello,

Is it possible to use sockets with the Stand-Alone LWIP? I would like to use the web-server from Altera for the MicroC/OS-II which is based on sockets but I’m not able to bring it to work. Does anyone have experiences in this topic?

Bye,

niosIIuser

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sorry the answer is No. The use of the sockets API requires a threaded environment.

    Below is the quote from the LWIP documentation, which can be found in the file rawapi.txt in the src/downloads/lwip-0.6.3/doc directory

    Raw TCP/IP interface for lwIP 0.5

    "lwIP provides two Application Program's Interfaces (APIs) for programs

    to use for communication with the TCP/IP code: the sequential API

    (often just called "the API") and the raw TCP/IP interface. This

    document is intended as a description of the latter. For lwIP versions

    lower than 0.5, this API was not documented.

    The sequential API provides a way for ordinary, sequential, programs

    to use the lwIP stack. It is quite similar to the BSD socket API. The

    model of execution is based on the open-read-write-close

    paradigm. Since the TCP/IP stack is event based by nature, the TCP/IP

    code and the application program must reside in different execution

    contexts (threads).

    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."
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello rugbybloke,

    Thank you for this hint now some thinks are clearer.

    Bye,

    niosIIuser