I
Ivan Voras
Peter said:call to recv() does not guarantee that the full 608 bytes of data is
Does read() have that guarantee?
Peter said:call to recv() does not guarantee that the full 608 bytes of data is
Zunbeltz said:I have a wxPython application that call makes a thread (with threading
module). In some moment i've to stop the thread but i need to finish a
funtion in the thread before it can stop. How can i achive this?
How did you intend to stop the thread in a manner which might be unsafe?
(Hint, unless you're doing something unusual, you can't.)
Zunbeltz said:I have a threaded object (Mythread). It checks if want_thread
variable is True to return. The problem is that this object
execute a function that is a tcp comunication
def Client(self,Request,Answer):
totalsent = 0
while totalsent < 608:
sent = self.sock.send(Request.struct2string()[totalsent:])
if sent == 0:
raise RuntimeError, "socket broken"
totalsent = totalsent + sent
^^^^^^^^^^^^^^^^^^^^^^^^^^ BAD CODEif Request.Codigo != 37:
self.WriteLog("Request",Request)
data = self.sock.recv(608)
Answer.string2struct(data)
if int(Answer.Param[9]) != 37:
self.WriteLog("Answer",Answer)
The Client function send a Request (them write it in a log file),
gets and answer and and write it. The problem is that when i stop
the thread a get somethime the Request writed but not the answer,
as if the funciton Client returns before it ends.
Ivan said:Does read() have that guarantee?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.