[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] BSD select()

From: Igor Auzokoa
Subject: [lwip-users] BSD select()
Date: Thu, 24 Feb 2005 10:46:56 +0100

I am trying to use BSD socket library in my no OS design. I have compiled
lwip in my system and I want test it with the chargen.c example. It uses the
select() function and the lwip documentation says:
"17 BSD socket library
This section provides a simple implementation of the BSD socket API using
the lwIP API. The
implementation is provided as a reference only, and is not intended for use
in actual programs.
There is for example no error handling.
Also, this implementation does not support the select() and poll() functions
of the BSD
socket API since the lwIP API does not have any functions that can be used
to implement those.
In order to implement those functions, the BSD socket implementation would
have to communicate
directly with the lwIP stack and not use the API."
Is this true?

In the chargen example lwip_selscan(...) function is called by
lwip_select(...) function and it test if (p_sock->lastdata ||
p_sock->rcvevent) to see if this socket is ready for read. I dont know how
lastdata or rcvevent are actualized if chargen do not call recv() or

static int
lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set
    int i, nready = 0;
    fd_set lreadset, lwriteset, lexceptset;
    struct lwip_socket *p_sock;


    /* Go through each socket in each list to count number of sockets which
       currently match */
    for(i = 0; i < maxfdp1; i++)
        if (FD_ISSET(i, readset))
            /* See if netconn of this socket is ready for read */
            p_sock = get_socket(i);
            if (p_sock && (p_sock->lastdata || p_sock->rcvevent))
                FD_SET(i, &lreadset);
                LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for 
        if (FD_ISSET(i, writeset))
            /* See if netconn of this socket is ready for write */
            p_sock = get_socket(i);
            if (p_sock && p_sock->sendevent)
                FD_SET(i, &lwriteset);
                LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for 
    *readset = lreadset;
    *writeset = lwriteset;

    return nready;

Can anyone help me?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]