I am working on an application that uses screen scraping to extract information from a IBM 3270 telnet emulator. This is working great BUT I'm having some issues with the communication between my application and the emulator.
Every now and then the emulator just stops communicating back towards my application and that makes the thread that is performing the screen scraping unresponsive. There are built in methods for checking if the emulator is ready and all that but sometimes it just stops returning anything.
This says to the emulator: If you are not ready for input within 30 seconds then do blablabla. This works 99,99% of the time I use it but sometimes it just hangs and does not return neither true or false... massive problem.
How should I handle this? I have a ticker running on my main thread that checks the last time of activity and if it is over 30 seconds then it goes into an error handler but if I try to handle the thread that is unresponsive (eg. thread.Abort()) my main thread also becomes unresponsive, I guess it's waithing for the emulator thread to abort but since it's unresponsive it isn't possible.
I'm very new to multithreaded applications so all tips and tricks are welcome! I'm using a backgroundworker for my emulator thread.
I hope I have explained my problem enough, if not I'll try to ellaborate!