BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIdTCPServer,TIdPeerThread, its data property and the Termin

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Joel Harris
Guest





PostPosted: Thu Sep 11, 2003 5:19 am    Post subject: TIdTCPServer,TIdPeerThread, its data property and the Termin Reply with quote



I am assigning an instance of a TDataModule descendant to the Data property
of each TIdPeerThread in the OnConnect event handler of my TIdTCPServer
object. If there is a client connected when I set the TCPServer.Active
property to false I always get a Terminate Thread Timeout Error. I am not
freeing the data module myself. I am allowing the thread to do it for me.
If I do not assign anything to the data property the error does not occur.
Besides not assigning anything to the data property, how do I fix this?

I am using Indy 9.00.14 in Delphi 7 on windows XP

Thanks much,
Joel Harris
Ebbhead89



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Sep 11, 2003 6:29 am    Post subject: Re: TIdTCPServer,TIdPeerThread, its data property and the Te Reply with quote




"Joel Harris" <noone (AT) nospam (DOT) dammit.com> wrote

Quote:
If there is a client connected when I set the TCPServer.Active
property to false I always get a Terminate Thread Timeout Error.

What does your actual code look like? Are you assigning the same
TDataModule to each thread or are you instantiating a new instance each
time? What is the value of the server's TerminateWaitTime property? Before
getting the timeout, are any of the thread's OnException event being
triggered, by chance?


Gambit


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03




Back to top
Joel Harris
Guest





PostPosted: Thu Sep 11, 2003 2:31 pm    Post subject: Re: TIdTCPServer,TIdPeerThread, its data property and the Te Reply with quote




"Remy Lebeau (TeamB)" <gambit47 (AT) yahoo (DOT) com> wrote

Quote:
What does your actual code look like?
Here is the OnConnect event. Let me know if you'd like to see some other

part of the code. At this point in the development of the application the
data module isn't used anywhere else, but it will be.

procedure TMainForm.TCPServerConnect(AThread: TIdPeerThread);
var
ConnStr: string;
dm: TServerDataModule;
begin
ConnStr := StringReplace(CONN_STRING,'[UN]',DBUN,[]);
ConnStr := StringReplace(ConnStr,'[PW]',DBPW,[]);
ConnStr := StringReplace(ConnStr,'[DB]',DB,[]);
ConnStr := StringReplace(ConnStr,'[SERVER]',DBServer,[]);
dm := TServerDataModule.Create(ConnStr, nil);
AThread.Data := dm;
PostMessage(Application.MainForm.Handle, WM_CONN_OPEN, integer(AThread),
AddAtom(PChar(AThread.Connection.LocalName)));
AThread.OnException := testerror;
end;

Quote:
Are you assigning the same TDataModule to each thread or are you
instantiating a new instance each
time?
I am instantiating a new instance each time.


Quote:
What is the value of the server's TerminateWaitTime property?
The TerminateWaitTime property is set to the default value of 5000


Quote:
Before getting the timeout, are any of the thread's OnException event being
triggered, by chance?
No, it appears not to. Thanks for your attention.





Back to top
trelloW_leachiM_tenesU
Guest





PostPosted: Thu Sep 25, 2003 1:30 pm    Post subject: Re: TIdTCPServer,TIdPeerThread, its data property and the Te Reply with quote

If itīs not possible for handling Athread.Sychronize(TMethod) have a
look at TCriticalSection. You NEVER should access VCL-Components
during Thread.Execute (f.e. onConnect, onExecute, etc.)

Have a lot of fun:)
Michael:)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.