Another non blocking method in thread

Discussion in 'Python' started by Prashant, Jun 10, 2012.

  1. Prashant

    Prashant Guest

    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
     
    Prashant, Jun 10, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hendra Gunawan
    Replies:
    1
    Views:
    13,076
    Allan Herriman
    Apr 8, 2004
  2. Andre Kelmanson

    blocking i/o vs. non blocking i/o (performance)

    Andre Kelmanson, Oct 10, 2003, in forum: C Programming
    Replies:
    3
    Views:
    997
    Valentin Tihomirov
    Oct 12, 2003
  3. nukleus
    Replies:
    14
    Views:
    912
    Chris Uppal
    Jan 22, 2007
  4. Christian
    Replies:
    5
    Views:
    760
    Esmond Pitt
    Dec 2, 2007
  5. Serge Savoie
    Replies:
    4
    Views:
    292
    Serge Savoie
    Oct 1, 2008
Loading...

Share This Page