Checking TCP/IP connection when using GUIs



Hi

I am currently programming a GUI to communicate with a remote host via TCP/IP. I use the fopen, fprintf and fscan functions to do so on a TCP/IP object I have created. This works fine so far.
Now the part I am not sure how to accomplish.
My server/remote host is able to send out a signal when my client (GUI) is connected, to tell that the connection is alive e.g. "Your are connected", therefore I want to check for this message every e.g. 1 sec. to check if my connection is up and running, but to do so, according to my knowledge, I have to place my scan in a loop that checks every second.
So my questions are
1) Where do I have to place this loop in my GUI-code to make it check every second that the connection is ok without me pushing any buttons?
2) and will this lock my entire GUI so that I cannot execute any other callbacks or can I somehow still execute my callbacks?

Hope that someone can help

Best regards
Simon
.