473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

star_new_thread

please take a look at my code (short version)
http://chiu424.hypermart.net/code5.py.txt

I write a instant messaging app over bluetooth

My code will send / receive data from a bluetooth socket (same concept
TCP socket) at the same time

The code has infinite loop poll for and send data to the socket

but I want to have 2nd thread taking user input text and send to the
socket

I used
thread.start_new_thread

but the code hangs forever

========================================
here is the code with only signle thread (send / receive) data at same
time working OK - it can send text + receive text from socket

http://chiu424.hypermart.net/code5f.py.txt (full version) - works OK

========================================
after change the code to use - thread.start_new_thread, the code hangs
forever at the begin of while loop and never execute
self.timer.after(3, self.timeout_h)

http://chiu424.hypermart.net/code5e.py.txt (full version) - hangs

Thank you
Feb 12 '07 #1
1 1172
Simpified the code to use FUNCTION only without CLASS
http://chiu424.hypermart.net/code5-demo2.py.txt (short version)

the above code start a new thread to run the function that send /
receive data to socket, but still hangs at the timeout_h function
forever

==================================
http://chiu424.hypermart.net/code5i.py.txt (full version)
above used threads to send /receive data to socket, will hang at
function timeout_h forever

ANYONE KNOWS WHY?????

==================================
http://chiu424.hypermart.net/code5j.py.txt (full version)
above used single thread and it can receive and send data at the same
socket at same time

ANY ONE KNOWS why the one with 2 threads doesn't work ??????

thank you
Feb 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.