message_to_network should already be a function that waits for a new message to reach the socket. I'm guessing about its implementation, but you should just need to call that function -- it will return as soon as the message arrives, or when the connection times out. Obviously, it makes no sense to close the socket.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177