I'm doing some program in python and i'm having a very strange behavior when I call socket.rcvfrom inside a thread. This is what I'm doing:
def start(self):
try:
thread.start_new_thread(self.msgHandler , ())
except:
print "Error: unable to start thread"
...
def msgHandler(self):
while True:
try:
data = self.sock.recv(1024)
print data
except socket.timeout:
continue
What is happening is that when I send one message to that socket the thread will not print the data received, it gets stuck there. If I press ctrl+c to kill the process the message content will be shown on screen.
[EDIT] Now I know it is related with gtk.main() witch I am also using.