🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4234

Re: A Question on Sockets and DLL

#4234
From: Bob Gonder
Date: Mon, 07 Mar 2005 18:44
35 lines
2734 bytes
mike wrote:

>> You weren't clear if the "Clients" are just several threads in a
>> single Process, or seperate Processes.
>
>The Clients connect to a single process and each connection is a thread 
>within the process.

Still not clear. Are you saying there are several Client processes
connecting to a single Server process that is multi-threaded?

And, is it the Clients that use the DLL or the Server?

>> Multiple Threads within a single Process can access the same instance
>> of the DLL. They will share the DLL, and all of it's data.
>>
>> As to "conflict", that depends on what sort of conflilct you are
>> concerned about, and how the DLL was written.
>
>So in my case it is necessary to have the data returned from the DLL be 
>independent of any other thread calling the same procedure from the DLL. I'm 
>almost positive the DLL is not written in a threaded manner.

If the DLL hangs on to the data, or is "statefull" (remembers what it
is doing), then all threads will see the same state/data, and you will
likely have problems using it multi-threaded.

>So if I need to keep the data discrete between the multiple threads within 
>my process is it acceptable to use the syncronize manner of accessing the 
>DLL, or is there some other way for me to approach the problem.

If the DLL hands you the data, and then doesn't remember it, then yes,
you can save the data in your thread (local stack variable). And, if
the code isn't reentrant, then I suppose some locking mechanism is in
order.
Technical Details
Message-ID: <f67p21pil8brk4cg777ivcm87aresmjbe1@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <422b24ec@newsgroups.borland.com> <j8bm21hiql7v0dhlde0vaemcm7a10ib71m@4ax.com> <422c5d02$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,fce3d93441a242e3
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: A Question on Sockets and DLL
Date: Mon, 07 Mar 2005 10:44:14 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <f67p21pil8brk4cg777ivcm87aresmjbe1@4ax.com>
References: <422b24ec@newsgroups.borland.com> <j8bm21hiql7v0dhlde0vaemcm7a10ib71m@4ax.com> <422c5d02$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.91.205
X-Trace: newsgroups.borland.com 1110221052 69.69.91.205 (7 Mar 2005 10:44:12 -0800)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail