buglwIP - A Lightweight TCP/IP stack - Bugs: bug #27116, select() does not appear to work...


You are not allowed to post comments on this tracker with your current authentication level.

bug #27116: select() does not appear to work with timeval of 0

Submitted by:  Cathal <cobroin>
Submitted on:  Mon 27 Jul 2009 08:22:16 AM UTC  
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.1.1

Tue 28 Jul 2009 12:07:33 PM UTC, comment #4: 

I'm using the little function I posted earlier ReadTimeOut(sock, timeout); (because the socket option was not available back then)
- UDP socket
- TCP socket
- TCP listening socket
With timeout >= 0, and it works in all cases.
I think you had a problem when upgrading VDSP, because you should have at least version 1.2.0.
I will send you the little adaptation I made to use 1.3.0 with VDSP.

BTW: my first name is Stephane with a silent E, and no I, I'm not a girl ;-)

Stephane Lesage <slesage>
Mon 27 Jul 2009 08:26:36 PM UTC, comment #3: 

I am also using version 5.0 update 6 of Visual DSP++ though.

Stephanie did you test with a listen socket or a regular socket?

Cathal <cobroin>
Mon 27 Jul 2009 02:05:58 PM UTC, comment #2: 

Sounds like this has already been fixed.  I'll resolve as such, but please re-open if current versions of lwIP don't do as you expect.

Kieran Mansley <kieranm>
Project Member
Mon 27 Jul 2009 08:44:33 AM UTC, comment #1: 

select with timeout 0 perfectly works for me on BF536.
You should upgrade to Visual DSP++ 5.0 Update 6, it has a more recent version of LwIP:


int ReadTimeOut(int sock, int tv_ms)
// Set up FD set and timeval
fd_set efds;
FD_SET(sock, &efds);
struct timeval tv;
tv.tv_sec = tv_ms/1000;
tv.tv_usec = 1000*(tv_ms%1000);

// Wait socket for specified timeout
return select(sock+1, &efds, NULL, NULL, &tv);

Stephane Lesage <slesage>
Mon 27 Jul 2009 08:22:16 AM UTC, original submission:  

when a timeval structure has tv_sec and tv_usec set to 0 and then is passed as the fifth argument for select() any fd_set structure also passed is always all set to 0, and 0 is always returned.

When a non-zero value is used for tv_usec such as 500 the select() function behaves as expected.

I am using the Analog Devices port of the lwip stack which does not appear to provide any reasonable way to debug or alter the stack.

Does this issue exist for others on 1.1.1 and does it exist on later revisions?

Cathal <cobroin>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by slesage (Posted a comment)
  • -email is unavailable- added by cobroin (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-07-27 kieranm StatusNone => Works For Me
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.5