Forum > Ported from Delphi/Kylix

Indy Client in a Thread

<< < (3/3)

Remy Lebeau:

--- Quote from: JimKueneman on November 01, 2023, 02:19:59 pm ---Remy are

procedure IdTCPServerExecute(AContext: TIdContext);

connections serialized calling this function?

--- End quote ---

No.  Each connection runs in its own worker thread, so the OnConnect/Execute/Disconnect events run in parallel when multiple clients are connected to the server.


--- Quote from: JimKueneman on November 01, 2023, 02:19:59 pm ---I am having this strange hard to reproduce bug with a stream I am using for a read in the function.  It seems like the Size is changing in the middle of a for loop when I am iterating through it within this function but I have not been able to catch it when I add a bit of code to test for it.

--- End quote ---

Are you sharing a stream across clients?  If so, you need to protect the stream from concurrent access across threads.

JimKueneman:
Ok then that explains it.. thanks.

Jim

Navigation

[0] Message Index

[*] Previous page

Go to full version