View Single Post
Old 09-12-2004, 05:36 PM  
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default making a winsock listen loop in C

i'm wondering about this, for the purpose of server applications. every loop i've ever made to listen for connections utilizes close to 100% cpu because of constant conection checks.

basically i always end up with something like this (in psuedocode)

main {

pre configuration routines;
open socket for listening;

loop {

if (conection) {
dosomething
}

close socket;
post routines;
return;

}

how do i do this better, or how do i make it utilize less cpu resourcees? i'm good with C but am not familiar with the available windows API, so i don't really know about controlling cpu utilization via setting a variable or whatever.. please help
mr_F_2 is offline