Hi, done a search on multithreading and became a bit wiser, but not as wise as I was hoping for


In this program I'm writing I've got 2 "almost" infinite loops (until I say STOP that is) that need to be run all the time. It's socket testing ...

So the first thread contains a server listening process. I'm trying to get a multi-user server ready. Therefor I need to constantly "listen" -> thread must be kept alive

Once a client is connected, the first loop creates a new thread. This thread is the socket receive code. This is also an "infinite" loop (until a certain command) because a client can type anything at any moment.

The second thread is being executed but seems to stop almost immediately to continue on running the first thread...

Now, I was thinking ... isn't there a way to switch threads every now and then...
so :
--- thread 1
--- thread 2
--- thread 1
--- thread 2

....

Any ideas and solutions are welcome !
Vamp