wx.Yield() during socket timeout

K

Kiran

Hello All,
I am creating a socket connection in order to read and write to a
location. My problem is,the gui becomes unresponsive if the socket
times out.
I know that a good solution is to have the socket read and write with
a thread. However, I have tried this and have a problem where ONLY on
linux does the program crash, it DOES NOT crash on windows xp. I have
been trying to figure out why for about a week and have just given up.
Instead, I am now tryign to use wx.Yield() which will allow the gui
to be updated. However, during timeouts, the gui still hangs.

Does anybody have any clever ideas on how I could call the function
wx.Yield() during a timeout so that the GUI stays responsive? I have
already tried timers, and they dont work.

thanks for your help,
Kiran
 
D

Dennis Lee Bieber

Hello All,
I am creating a socket connection in order to read and write to a
location. My problem is,the gui becomes unresponsive if the socket
times out.

First question is: what do you mean by a "socket timeout"

If you mean you are performing a socket operation that blocks until
satisfied, or has a time-out period for which it waits before returning,
then of course things look unresponsive.
Does anybody have any clever ideas on how I could call the function
wx.Yield() during a timeout so that the GUI stays responsive? I have
already tried timers, and they dont work.
Don't use blocking I/O calls inside the GUI mainloop... Use
something like select() if you can't use threads...

while true:
(i,o,e) = select.select([insocket], , , 0) #polling loop
for asocket in i:
data = asocket.recv(...)
wx.Yield()
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
F

Frank Millman

Kiran said:
Hello All,
I am creating a socket connection in order to read and write to a
location. My problem is,the gui becomes unresponsive if the socket
times out.
I know that a good solution is to have the socket read and write with
a thread. However, I have tried this and have a problem where ONLY on
linux does the program crash, it DOES NOT crash on windows xp. I have
been trying to figure out why for about a week and have just given up.

You must have a bug in your threading code. I am doing something
similar to what you describe, and it works perfectly, on Windows and on
Linux.

Threading *is* the correct approach for what you are attempting. Don't
give up. Try to isolate where the crash happens, and post the relevant
section of code here. If I can't spot the error, there is a good chance
someone else will.

Frank Millman
 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,271
Latest member
BuyAtenaLabsCBD

Latest Threads

Top