socket and thread

ZeeGeek ZeeGeek at gmail.com
Thu Jan 8 17:52:18 CET 2009


I'm writing a small program which uses different threads to monitor an
IMAP mailbox and an RSS feed. If network is not available when the
program starts, both threads will sleep for a while and try again. It
seems that the first thread succeeds when the network becomes
available will cause the other thread to always give a gaierror "No
address associated with hostname". The weird thing is that this only
happens when the program starts with network unavailable. If network
is available when the program starts, both threads work well, even if
the network drops in the middle, the threads can recover properly when
the network comes back alive. Is Python socket thread-unsafe or is it
because of some other problems?

Thanks.



More information about the Python-list mailing list