|
#1
|
|||
|
|||
Sending a value by Thread
Hello everyone.
I'm using socket and thread on my code and I'm trying to get a value that I have received by thread and put it on my code. My variable is global, but I can't get the result out of the thread. def recMsg(): global msg try: print "Conected!!" while True: ip = "localhost" buffer= 1024 port= 8080 address= (ip,porta) UDP = socket(AF_INET,SOCK_DGRAM) UDP.bind(address) # Recebe mensagens msg, address= UDP.recvfrom(buffer) # Encerra o socket UDP.close() except: print "Error" #Start Thread try: thread.start_new_thread(recMsg,()) except: print "Thread error" # I would like to print my result here # print msg for example Thanks for help me ! |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sending an email from Vizard | starlingstm | Vizard | 0 | 01-22-2012 11:08 AM |
Prioritize Director thread | aznan | Vizard | 9 | 05-14-2008 09:57 AM |
sending event markers to a monitoring computer | mikestatic | Vizard | 3 | 01-26-2006 09:23 AM |
Sending Objects With Pickle | Vygreif | Vizard | 6 | 11-05-2005 02:42 PM |
running into a thread limit | tavaksai | Vizard | 4 | 10-27-2004 03:59 PM |