Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Apr : TIdTCPServer - threads, global data contd.

www.cryer.info
Managed Newsgroup Archive

TIdTCPServer - threads, global data contd.

Subject:TIdTCPServer - threads, global data contd.
Posted by:"Stephen Odgaard" (s..@cowi.dk)
Date:Sun, 16 Apr 2006 01:18:51

I have with interest read the thread by Mathijs, Martin James and Remy
Lebeau on the above topic.

I am also in the process of implementing my first IdTCPServer, so I need to
get some basics straight here.

The purpose of the Application is to work as a sort of Router, which means
that I have to send data from Clients connected, but I also have data
initiated by the server (or other Clients to be sent to a given Client)

As I read the thread the conclusion is that data should be stored in eg. a
TThreadList, or in a special strucuture with a critical section. A couple of
questions:

Reg. the OnExecute Event handler:
1a) Can I from the main thread get access to a list of connected clients
(ie. with connected clients)
1b) What initiatiates the OnExecute Event?
1c) How can I (eg. from the main thread) "provoke" the OnExecute Event
handler of a given client to be executed in order to empty an outbound info
queue?
1d) How would you store data in relation to a specific client for use during
later Execute handles (or another thread)?

Thread safe global data.
You mentioned the TThreadList as an example of storing threadsafe data. And
alternatively to make ones own class with a critical section.
2a) Do you have an example of such a class implementation for my
inspiration?
2b) Do you Mathijs have any working code example based on the discussion you
had with Martin and Remy that you could share?

Thanks in advance

Stephen

Replies:

www.cryer.info
Managed Newsgroup Archive