Re: WaitFor not timing out - WeOnlyDo Discussion board

Re: WaitFor not timing out (General questions)

by Ryan, Tuesday, May 25, 2010, 01:48 (5295 days ago) @ wodDamir

Ryan,

Can you please show me your loop where you call the WaitFor method, and send out the bell char?

Also, you're Waiting for the same bell character or something else?

Regards,
Damba

Hi,
Unfortunately it is not my code which is in the loop sending the bell character, it is being sent from the database we use over telnet.

The code which i am calling waitFor is as follows:

//this line can cause an infinite block
returnedData := FTelnet.WaitFor( SearchData , FMainTimeout );

The problem is that this call blocks forever. I am waiting for a different character so i would expect a timeout, however the timeout never occurs and my program is therefore stuck forever. I believe this is because a problem exists in your waitFor method where it receives a constant stream of data such as bell characters.

Are you aware of this situation? I am not sure exactly how you have implemented the waitFor method, but it sounds as though it is just a loop of receives which relies upon the timeout of the receive method. If this is the case then a constant stream of data will cause an infinite loop as receive will always return something (but not the char i am waiting for). The waitFor will actually have to contain its own timer and raise an exception when it expires. Does it do this?

I can probably write my own waitFor method but i was hoping not to do this.
Please let me know if you need any further info.

Thanks,
Ryan.


Complete thread: