cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
aminfar1
Explorer
Explorer
5,746 Views
Registered: ‎01-09-2009

Using lwip_select to enable timeout

Jump to solution

Hi,

 

I am trying to add the timeout functionality to the echo server program presented in XAPP1026. I am adding the lwip_select() function to the program and using an approach which is similar to this. The lwip_select() function should indicate which of the specified file descriptors is ready. If no one is ready, it should block up to the specified timeout interval. If successful, the lwip_select() returns the number of ready descriptors that are contained in the bit masks. If the time limit expires, select returns zero.

 

My problem is that any time I call this function it immediately returns 0, no matter how long the timeout interval is. I don't know if something is wrong with the timer/interrupt or I have written a bogus code.  Any thought?

 

 

int new_sd; //socket descriptor
struct timeval tv; //used for timeout interval
fd_set rfds; //file descriptor

// ... making socket, and accepting connection ...

while (1) {

/* Zero socket descriptor vector and set for server sockets */
FD_ZERO(&rfds);
FD_SET(new_sd, &rfds);

/* time to wait for data to be received */
tv.tv_sec = 10;
tv.tv_usec = 0;

int sel_ret = lwip_select(new_sd+1, &rfds, NULL, NULL, &tv);
xil_printf("%d\n\r",sel_ret); //always prints 0 immediately which is incorrect
.....

}

 

 

0 Kudos
1 Solution

Accepted Solutions
aminfar1
Explorer
Explorer
7,291 Views
Registered: ‎01-09-2009

To make lwip_select work, I modified the default settings for the following parameters:

 

 PARAMETER max_sem_waitq = 20
 PARAMETER max_sem = 50

View solution in original post

0 Kudos
2 Replies
aminfar1
Explorer
Explorer
5,715 Views
Registered: ‎01-09-2009
Has anyone any ideas?
0 Kudos
aminfar1
Explorer
Explorer
7,292 Views
Registered: ‎01-09-2009

To make lwip_select work, I modified the default settings for the following parameters:

 

 PARAMETER max_sem_waitq = 20
 PARAMETER max_sem = 50

View solution in original post

0 Kudos