| Reply | « Previous Thread | Next Thread » |
|
My application involves the creation of bluetooth server and client sockets, as well as a UI, all within the same application. I would like to run the bluetooth server and client sockets as their own separate respective threads. The server and client sockets are implemented in their own classes and own their own locks. They will not share any data between them, but rather will read and write to a database (implemented using e32db). However, what I have written so far always blocks on the server_socket.accept() method. The server and client socket threads are started in the following way:
Server: Code:
def run(self): # Dummy run program for right now while 1: self.lock.acquire() clientSocket, clientAddress = self.serverSocket.accept() # do some stuff clientSocket.close() self.lock.release() Code:
def run(self): # Dummy run program for right now while 1: self.lock.acquire() self.clientSocket.connect((serverAddress, serverPort)) # do some sending and receiving self.clientSocket.close() self.lock.release() Code:
thread.start_new_thread(clientObject.run, ()) thread.start_new_thread(serverObject.run, ()) What I would like to do is to be able to run the server and client threads in the background in the context of a UI program. My application is an ad-hoc bluetooth networking system where each phone can server as a send and receive node. I realize I could simply make the client and server threads separate applications; the reason to do all of this within one application is because of my target users, as they may not have the technical-know how to start multiple applications and keep them running, but I _am_ able to tell them how to start one application and leave it running in the background. Thanks for your help, and let me know if there is anything I might be missing, or any other clarification I need to make! nick |
|
I hate to be that person who bumps his own thread, but just curious if anyone has thoughts as to this problem. A simple "it's easy, just work on it more!" or "it's impossible, give up and split up the server and the client" would be fine
![]() thanks! |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |