Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Another non blocking method in thread

Reply
Thread Tools

Another non blocking method in thread

 
 
Prashant
Guest
Posts: n/a
 
      06-10-2012
Hi,

I have created a very simple client-server model using sockets. Server is created by sub classing threading.thread. The 'run' method is continuously listening for client's response. When server send a string to client, clientresponse back by changing that string into uppercase.
I would like to synchronize send and receive. For example:

def sendmsg(self, msg):
self.client.send(msg)
#wait until next msg is received in 'run'
return self.response

I tried using a while loop for waiting but it's blocking the 'run' method. Don't know much about threading event and lock and if they can help me here..

Any pointers?

Prashant
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non blocking socket keep blocking on read ? Serge Savoie Ruby 4 10-01-2008 03:16 PM
Switching from Non-Blocking to Blocking IO Christian Java 5 12-02-2007 11:24 PM
Non-blocking and semi-blocking Sockets class. nukleus Java 14 01-22-2007 08:22 PM
Blocking and non blocking assignment in VHDL Hendra Gunawan VHDL 1 04-08-2004 06:03 AM
blocking i/o vs. non blocking i/o (performance) Andre Kelmanson C Programming 3 10-12-2003 02:09 PM



Advertisments