The TCP "Create Listener" and "Wait on Listener" functions may help you achieve what you want. Depending on your particular applciation though, this may not be necessary.
You could create one loop dedicated to the tcp operations, and another to handle the rest of your application. Have the two loops communicate to each other through a message queue, and you have yourself a reasonably efficient architecture.
Just some ideas - hope they help!
John H.