Re: TCP Server

Giganews Newsgroups
Subject: Re: TCP Server
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Wed, 19 Aug 2009

"Alan T" <alan_NO_SPAM_plt…@yahoo.com.au> wrote in message
news:743012836B8DE340alan_NO_SPAM_plt…@yahoo.com.au...

> Just wonder how the TCPServer differentiate different connections from
> clients?

Each client runs in its own thread, and has its own TIdPeerThread (Indy 9
and earlier) or TIdContext (Indy 10) object associated wih it.

> When the server is listening to the port, eg. 9000, multi-client are
> requesting file and how the server can send different file to
> different clients?

You are supposed to do all of your work in the context of the thread that
manages the client connection, such as in the server's OnExecute event.
Then you don't need to differentiate, since everything is local to each
connection.

--
Remy Lebeau (Indy Team)

Replies

In response to

TCP Server posted by Alan T on Wed, 19 Aug 2009