Have him look at postgresql's server code. The bit that does socket handling is pretty easy reading.<br><br>Although handling thousands is a stretch<br><br>Dave<br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 10:33 AM, Ken Burtch <span dir="ltr"><<a href="mailto:ken-8VyUGRzHQ8IsA/PxXw9srA@public.gmane.org">ken-8VyUGRzHQ8IsA/PxXw9srA@public.gmane.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Any socket gurus out there?<br>
<br>
I had a question from a guy at work writing his own socket server in C. He is writing an application which needs to handle thousands of users.<br>
<br>
He would like to know the most efficient way of servicing sockets.  Although he blocks on sockets with a select(2) call to the kernel, he must still search thorugh the select list to determine which socket needs to be serviced.  He would like to know if there is a more efficient way to handle the socket stack.  In particular, he heard that there is a way to have the kernel call a C function to processess particular sockets but he doesn't know how to set that up nor is he certain if he has to use a custom kernel module to achive this.  Can anyone give him pointers on how to make searching through the select(2) results more efficient or give him a more efficient alternative to select(2) for managing large numbers of sockets?<br>

<br>
Thanks,<br>
Ken B.<br>
<br>
-----------------------------------------------------------------------------<br>
Ken O. Burtch                                       Phone/Fax: 905-562-0848<br>
  "Linux Shell Scripting with Bash"                  Email: <a href="mailto:ken@pegasoft.ca" target="_blank">ken-8VyUGRzHQ8IsA/PxXw9srA@public.gmane.org</a><br>
  "Perl Phrasebook"                 Blog: <a href="http://www.pegasoft.ca/coder.html" target="_blank">http://www.pegasoft.ca/coder.html</a><br>
-----------------------------------------------------------------------------<br><font color="#888888">
--<br>
The Toronto Linux Users Group.      Meetings: <a href="http://gtalug.org/" target="_blank">http://gtalug.org/</a><br>
TLUG requests: Linux topics, No HTML, wrap text below 80 columns<br>
How to UNSUBSCRIBE: <a href="http://gtalug.org/wiki/Mailing_lists" target="_blank">http://gtalug.org/wiki/Mailing_lists</a><br>
<br>
</font></blockquote></div><br>