Hello,
I am going to be making a SOCKS4/5 proxy and have been thinking about the best way to implement it. I don't plan on adding a gui yet, so I have basically decided to run it through the console. My first problem I am coming across is how to keep the program alive. Obviously I will have a loop running that will delay termination, but what conditions should my loop check?

I feel that if I checked the status of the socket every loop, it seems to me the program would be rediculously cpu intensive. What methods would any one suggest for keeping it alive?