Re: Semaphores and .NET
- From: "William Stacey [MVP]" <staceyw@xxxxxxxx>
- Date: Tue, 23 Aug 2005 23:52:22 -0400
Change the monitor to a named mutex and use a mem mapped file to hold the
shared counter (or plain disk file).
--
William Stacey [MVP]
"jinksk" <jinksk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:111358AA-B03E-4D15-AAF8-8FFBD1488442@xxxxxxxxxxxxxxxx
> William;
> Thanks for your advice and the code but this still does not solve the
> problem. The two applications are two separate executables that run
> simultaneously and need to share resources. Actually there are three;
> however, the customers I have to get this working for use only two of
> them.
> The Monitor class only works within a single application. It can only
> limit
> access to objects created by that executable and its underlying threads. A
> seperate executable does not have access to the same instance of the
> Monitor
> class that was created by the first stand alone application.
>
> What I need is a method to synchronize access to the RAS system where
> one stand-alone application does not interfere with the access to the RAS,
> DUNS, and Internet of another stand-alone application: given that I
> control
> the source code for both. We do not have the luxury at this time of
> completely re-writing the VB6 app in C# or even porting it to VB.NET. I am
> the only one working on the connectivity part of these two applications
> and I
> also have to handle the hand-written EDI translaters for the project. I
> have
> until the end of September to accomplish this.
>
> I know, you probably get projects like this thrown in your face every
> day. Let me just put the overview out for you for just a minute.
>
> 1.) We have 2 separate stand-alone applications we use to transmit data
> over
> the Internet via a IPSec VPN.
>
> 2.) The newest of these is written almost completely in C#.NET and only
> uses
> 1 ActiveX component: a Dialer from Catalyst. This application will
> eventually
> take over all of our connectivity needs except for faxing.
>
> 3.) The older stand-alone application is written in VB6 and uses the old
> Cresent Internet Controls. We still conduct our primary transfers via this
> app (where the $$$'s go).
>
> 4.) They want me to create a means by which if one of these dials into the
> VPN first and then the second needs access as well to have the second skip
> the dialer routine (that part I've got figured out) and go ahead and log
> into
> the remote host.
>
> 5.) Now comes the tricky part, if the first app finishes its transfer
> before
> the second one, it cannot hangup the connection. And visa versa. Only when
> no
> one else is connected can the IPSec tunnel be dropped.
>
> See the dilema?
> --
> Kenneth A. Jinks, Jr.
> Lead Project Software Engineer
> LabCorp CPG - LCM Development
> Huntsville, AL
>
>
>
> "William Stacey [MVP]" wrote:
>
>> I did a managed semaphore in c# and has been on the CodeProject for some
>> time:
>> http://www.codeproject.com/csharp/DijkstraCountingSemaphore.asp
>> You should be able to modify for your needs.
>>
>> --
>> William Stacey [MVP]
>>
>> "jinksk" <jinksk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:905158FC-E844-47CA-A263-08179F5BB9C0@xxxxxxxxxxxxxxxx
>> >I have a C# application and a VB6 application that need to share a
>> >dialup
>> > connection to the internet. Don't ask why, this is one of those
>> > corporate
>> > "do
>> > or die" things.
>> >
>> > The only way I can see to do this is by using the combination of a
>> > MUTEX
>> > to
>> > create a Cross-application Singleton for the Dialing operation and a
>> > Named
>> > Semphore that can keep a count of how many processes are currently
>> > sharing
>> > the connection from the client's workstation into our corporate VPN
>> > extranet.
>> > I am trying to find an example of how to manage semaphores in C# in a
>> > class.
>> > I will have to translate the same into the VB6 for the legacy app.
>> >
>> > Using .NET 2.0 is not an option, they won't let me use a BETA. Neither
>> > is
>> > remoting. I have to make the access sharable between executables
>> > modules.
>> > Does any one have any ideas.
>> > --
>> > Kenneth A. Jinks, Jr.
>> > Lead Project Software Engineer
>> > LabCorp CPG - LCM Development
>> > Huntsville, AL
>> >
>>
>>
>>
.
- References:
- Semaphores and .NET
- From: jinksk
- Re: Semaphores and .NET
- From: William Stacey [MVP]
- Re: Semaphores and .NET
- From: jinksk
- Semaphores and .NET
- Prev by Date: Re: Do I need to recompile all apps if upgrading to SP1?
- Next by Date: Re: Visibility/Access of Class Members
- Previous by thread: Re: Semaphores and .NET
- Next by thread: Use PDF as coverpage in FAXCOMLib?
- Index(es):
Relevant Pages
|