View Single Post
Old 09-12-2004, 08:01 PM  
Syrinx
Junior Member
 
Join Date: Jun 2004
Posts: 25
Default Re: making a winsock listen loop in C

Quote:
Originally posted by mr_F
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
This model looks fine since all multi-threaded with blocking socket server application mostly in that form.I don't know what you mean by "constant conection checks".I gues your application must be something wrong in the code.
Syrinx is offline