PDA

View Full Version : Delphi 7, Indy TCP Components & Timers



Gadget
27-02-2005, 04:18 PM
I have just ported all my code from Delphi 4 to Delphi 7, phew.

After changing to Delphi 7 I am experiencing some wierd problems with the Indy Components and Timers. There is a timer on the login form that reads the TCP Socket at intervals. Once the form is displayed, it connects to the server socket and then starts the Timer. The timer appears to get no CPU, almost like the socket is hogging it. Even with an AntiFreeze component on there it makes no difference?

If I step through the code it works??? If I halt the code in execution (letting it just run until the timer isn't responding), it's nearly always sat at NTWaitForSingleObject.

Any ideas?

jamesa
02-03-2005, 08:40 PM
I dont know, Indy is blocking socket component. Consider to use non-blocking component, like SDL net.


I have just ported all my code from Delphi 4 to Delphi 7, phew.

After changing to Delphi 7 I am experiencing some wierd problems with the Indy Components and Timers. There is a timer on the login form that reads the TCP Socket at intervals. Once the form is displayed, it connects to the server socket and then starts the Timer. The timer appears to get no CPU, almost like the socket is hogging it. Even with an AntiFreeze component on there it makes no difference?

If I step through the code it works??? If I halt the code in execution (letting it just run until the timer isn't responding), it's nearly always sat at NTWaitForSingleObject.

Any ideas?

xGTx
02-03-2005, 11:43 PM
Thats awsome! 2 Years and over a Month later, gadget got a reply... LOL

WILL
03-03-2005, 06:52 AM
Uh... I think you should look at the dates for the post not when the members joinned. ;)

K4Z
03-03-2005, 07:40 AM
Try dropping an IdAntiFreeze on the form, that sometimes fixes Indy right up.

Gadget
03-03-2005, 03:19 PM
Try dropping an IdAntiFreeze on the form, that sometimes fixes Indy right up.

Hmm,

Me thinks you didn't read my thread :?


I had no problem at all using Delphi 4 with Indy components! Only since moving to Delphi 7 is this an issue! I am sure it's got nothing to do with them being blocking type as the old ones were, AND the clue here is that when in debug in the IDE it all works, it's only when it runs itself that the timer event never fires (at all).

AntiFreeze makes no difference at all >.<

Gadget
04-03-2005, 10:27 AM
OK, more information on this problem.

Timers have nothing to do with it! It appears that my main game loop is never running, because the application is never going into OnIdle state?

I have tried changing the IdAntiFreeze settings, OnlyOnIdle, priority etc, nothing seems to work? It's like the Indy components in Delphi 7 stop the app ever going into OnIdle?

Gadget
04-03-2005, 12:04 PM
OK, problem solved :)

I upgrade Indy to version 10, and all is OK =D It looks like there is somekind of problem with the Indy components that ship with Delphi 7.