Re: reached select() limit

2017-01-26 Thread David Guillen Fandos
My program mostly opens sockets, the responsible for fd starvation. If I create a socket and move it above 1024, and as log as I don't have, say 200 threads creating sockets, I can't run out of sockets under 1024 right? For that to happen all the threads would need to be after the dup and before th

Re: reached select() limit

2017-01-26 Thread Zan Lynx
On 1/26/2017 11:40 AM, David Guillen Fandos wrote: Genious! I didn't know about that thing! So you just dup the fd and close the old one right? Thanks! David On 26/01/17 16:41, Leif Thuresson wrote: Just remembered an quirk we used to do way back to over come a problem with old solaris version

Re: reached select() limit

2017-01-26 Thread Leif Thuresson
Yes - Just remember you must use fcntl(, F_DUPFD, ) not dup2(). /Leif On 2017-01-26 19:40, David Guillen Fandos wrote: Genious! I didn't know about that thing! So you just dup the fd and close the old one right? Thanks! David On 26/01/17 16:41, Leif Thuresson wrote: Just remembered an quirk w

Re: reached select() limit

2017-01-26 Thread David Guillen Fandos
Genious! I didn't know about that thing! So you just dup the fd and close the old one right? Thanks! David On 26/01/17 16:41, Leif Thuresson wrote: Just remembered an quirk we used to do way back to over come a problem with old solaris versions where the stdio struct used a char for the file de

Re: reached select() limit

2017-01-26 Thread Leif Thuresson
Just remembered an quirk we used to do way back to over come a problem with old solaris versions where the stdio struct used a char for the file descriptor. If you have control over the file descriptors you application is creating you can push them to higher numbers with newfd = fcntl(orgfd,

Re: reached select() limit

2017-01-26 Thread David Guillen
Ha! That's awesome, exactly what I was looking for. Thanks a lot Daniel! David 2017-01-26 14:32 GMT+01:00 : > You can also register callbacks using ares_options::sock_state_cb and > ares_set_socket_callback(), which simplifies things a lot. I used them when > I was integrating c-ares with our ep

Re: reached select() limit

2017-01-26 Thread daniel
You can also register callbacks using ares_options::sock_state_cb and ares_set_socket_callback(), which simplifies things a lot. I used them when I was integrating c-ares with our epoll-based code. Daniel W dniu 2017-01-25 18:48, David Guillen Fandos napisaƂ(a): Ha! Sorry for that, I just re