Delay for XMLSocket Messages

Hello,
I am writing an XMLSocket Flash program and basically on startup,
i call a funcion initialize, which connects the socket to the server and sends a message. Now I need to to wait for several startup messages from the server before I can continue. I need this to time out if they are not received. Does anyone have any ideas.
Much appreciated,
DumbMonkey.

getTimer()

or

setInterva()

Hi and thanks,
But I found if I do a while loop in the function, based on getTimer()
it blocks the application and does not send the first message until the loop is complete. I basically need a non-blocking delay in my function.
Thanks again,
DumbMonkey