BTW A thread-based approach is the best way to go.
All the in/out sending is done in a thread while the game loop runs without interference from the network.

Indy is great for this and includes alot of thread-safe variables and data structures.