What you should probably do is put accept() into asynchronous mode, or throw it in a new thread. It's a blocking function so that could screw up the rest of your program. So if you "call" it every once in a while, your program will hang on it.