Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: TIdSimpleServer or TIdTCPServer

www.cryer.info
Managed Newsgroup Archive

Re: TIdSimpleServer or TIdTCPServer

Subject:Re: TIdSimpleServer or TIdTCPServer
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 21 Feb 2007 13:20:25

"Philip von Melle" <philip.vonmelle@globetrotter.de> wrote in message
news:Xns98DEE0BD0A20Aphilipvonmelleglobe@207.105.83.66...

> My question si whether it is better to use TIdTCPServer or
> TIdSimpleServer here.

If B's requests to A are serialized, where a new request will not be
sent until the previous reply is received, then use TIdSimpleServer.
On the other hand, if multiple requests can arrive simultaneously,
then you have to use TIdTCPServer instead.

> And if the latter how to do that (what is the threading model, what
methods to call on TIdSimpleServer).

There are no threads involved with TIdSimpleServer.  Like
TIdTCPClient, it runs in the context of whichever thread is using it.
TIdSimpleServer is derived from TIdTCPConnection, just like
TIdTCPClient is, so it is a 1-to-1 connection, so you can read/write
to TIdSimpleServer like you would with TIdTCPClient.  The only
difference is that to establish the connection, you would call
Listen() in TIdSimpleServer, whereas you call Connect() in
TIdTCPClient.  You would also usually call BeginListen() before
Listen() in order to know which port to tell B to connect to.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive