Thread View: borland.public.csharpbuilder.language.csharp
1 messages
1 total messages
Started by Francois Piette [ICS & Midware]
Wed, 02 Aug 2006 08:09
threading issue with socket and arraylist
Author: Francois Piette [ICS & Midware]
Date: Wed, 02 Aug 2006 08:09
Date: Wed, 02 Aug 2006 08:09
21 lines
1924 bytes
1924 bytes
I'm writing a program which make use of asynchronous sockets. My program call Socket.BeginAccept() to make the .NET framework create a thread for me and make it wait for an incomming connection while my program continue to run normally. When a new connection comes in, my callback method (specified by BeginAccept) is invoked in the context of the worker thread managed by .NET. I call EndAccept to get the client connection. So far so good. When I have a client connection, I place it into a variable Clients of type ArrayList. That's where I have a problem: The variable Clients is accessed from the accept callback within the context of a worker thread and it is also accessed by the main thread. How do I manage thread synchronization ? Do I have to use a critical section or some C# equivalent contruction ? Any help appreciated. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- francois.piette@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads