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 and Synchronize when moving from Indy 9 to Indy

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





PostPosted: Fri Aug 18, 2006 2:15 am    Post subject: TIdTCPServer and Synchronize when moving from Indy 9 to Indy Reply with quote



In the execute method of the server component I used to use the AThread.
parameter to syncronize with the UI:

AThread.Synchronize(ShowTheMessageWindow);

How do I do this with Indy 10's version of the TIdTCPServer? How do I access
the thread the server is running under so I can access the Synchronize?

Thanks, Bruce
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Aug 18, 2006 3:32 am    Post subject: Re: TIdTCPServer and Synchronize when moving from Indy 9 to Reply with quote



"Bruce" <exnihilosys_nospam_ (AT) hotmail (DOT) com> wrote in message
news:44e4dc61$1 (AT) newsgroups (DOT) borland.com...

Quote:
In the execute method of the server component I used to use
the AThread. parameter to syncronize with the UI:

AThread.Synchronize(ShowTheMessageWindow);

How do I do this with Indy 10's version of the TIdTCPServer?

Use the TIdSync class, ie:

uses
IdSync;

TIdSync.SynchronizeMethod(ShowTheMessageWindow);

TIdSync is also available in Indy 9, so you can write code to cater for both
versions, if you wish, ie:

uses
IdSync;

type
TMySync = class(TIdSync)
{$IFNDEF INDY100}
pubilc
class procedure SynchronizeMethod(AMethod: TIdThreadMethod);
{$ENDIF}
end;

{$IFNDEF INDY100}
class procedure TMySync.SynchronizeMethod(AMethod: TIdThreadMethod);
begin
with Create do try
Thread.Synchronize(AMethod);
finally Free; end;
end;
{$ENDIF}

{$IFDEF INDY100}
procedure TMyForm.IdTCPServer1Execute(AContext: TIdContext);
{$ELSE}
procedure TMyForm.IdTCPServer1Execute(AThread: TIdPeerThread);
{$ENDIF}
begin
TMySync.SynchronizeMethod(ShowTheMessageWindow);
end;

Quote:
How do I access the thread the server is running under so
I can access the Synchronize?

You don't.


Gambit
Back to top
Bruce
Guest





PostPosted: Fri Aug 18, 2006 4:02 am    Post subject: Re: TIdTCPServer and Synchronize when moving from Indy 9 to Reply with quote



Thanks. How does TIdSync.SynchronizeMethod know which thread the
TIdTCPServer is running under? Do I need to link the components somehow?

Bruce

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:44e4eece$1 (AT) newsgroups (DOT) borland.com...
Quote:
Use the TIdSync class, ie:

uses
IdSync;

TIdSync.SynchronizeMethod(ShowTheMessageWindow);
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Aug 18, 2006 8:11 am    Post subject: Re: TIdTCPServer and Synchronize when moving from Indy 9 to Reply with quote

"Bruce" <exnihilosys_nospam_ (AT) hotmail (DOT) com> wrote in message
news:44e4f578$1 (AT) newsgroups (DOT) borland.com...

Quote:
How does TIdSync.SynchronizeMethod know which thread
the TIdTCPServer is running under?

It doesn't. Unless explicitally passed as a constructor parameter, TIdSync
will create its own helper thread internally and then calls Synchronize() on
that.


Gambit
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.