473,667 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Semaphores and .NET

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

Nov 17 '05 #1
34 6285
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby

Nov 17 '05 #2
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up on
the second one. The MUTEX would only prevent one from dialing while the other
one is dialing. The Semaphore tracks how many active transfers are going on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby

Nov 17 '05 #3
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX but will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up on the second one. The MUTEX would only prevent one from dialing while the other one is dialing. The Semaphore tracks how many active transfers are going on simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby

Nov 17 '05 #4
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up on
the second one. The MUTEX would only prevent one from dialing while the other
one is dialing. The Semaphore tracks how many active transfers are going on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby

Nov 17 '05 #5
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX but will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up on the second one. The MUTEX would only prevent one from dialing while the other one is dialing. The Semaphore tracks how many active transfers are going on simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby

Nov 17 '05 #6
I guess you should consider me dumb as dirt, because I can't see how I can
implement this in such a way that all processes will have access to the same
named semaphore when the only constructor that implements the name is
protected in your example. I am not being factious, I just don't understand.
Most of this is brand new to me and I seem to keep getting thrown the
projects that would even give MSDN MVP's pause for thought.

Would you please explain this a little further, Lebesgue, so that even a
clod like me could understand.

Thanks.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"Lebesgue" wrote:
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX

but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up

on
the second one. The MUTEX would only prevent one from dialing while the

other
one is dialing. The Semaphore tracks how many active transfers are going

on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby


Nov 17 '05 #7
I guess you should consider me dumb as dirt, because I can't see how I can
implement this in such a way that all processes will have access to the same
named semaphore when the only constructor that implements the name is
protected in your example. I am not being factious, I just don't understand.
Most of this is brand new to me and I seem to keep getting thrown the
projects that would even give MSDN MVP's pause for thought.

Would you please explain this a little further, Lebesgue, so that even a
clod like me could understand.

Thanks.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"Lebesgue" wrote:
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX

but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up

on
the second one. The MUTEX would only prevent one from dialing while the

other
one is dialing. The Semaphore tracks how many active transfers are going

on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby


Nov 17 '05 #8
I guess you should consider me dumb as dirt, because I can't see how I can
implement this in such a way that all processes will have access to the same
named semaphore when the only constructor that implements the name is
protected in your example. I am not being factious, I just don't understand.
Most of this is brand new to me and I seem to keep getting thrown the
projects that would even give MSDN MVP's pause for thought.

Would you please explain this a little further, Lebesgue, so that even a
clod like me could understand.

Thanks.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"Lebesgue" wrote:
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX

but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up

on
the second one. The MUTEX would only prevent one from dialing while the

other
one is dialing. The Semaphore tracks how many active transfers are going

on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby


Nov 17 '05 #9
I guess you should consider me dumb as dirt, because I can't see how I can
implement this in such a way that all processes will have access to the same
named semaphore when the only constructor that implements the name is
protected in your example. I am not being factious, I just don't understand.
Most of this is brand new to me and I seem to keep getting thrown the
projects that would even give MSDN MVP's pause for thought.

Would you please explain this a little further, Lebesgue, so that even a
clod like me could understand.

Thanks.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"Lebesgue" wrote:
A week ago, I posted a sample implementation of semaphore using Win32 API.
This solution can be adjusted so the semaphore handle can be shared among
processes, which will suit your needs, if I understand what you need to
accomplish.
This is were the implementation is posted
http://www.pcreview.co.uk/forums/pri....php?t=2099193
have a look at MSDN for settings you need to change when handle should be
shared among processes.
"jinksk" <ji****@discuss ions.microsoft. com> wrote in message
news:78******** *************** ***********@mic rosoft.com...
Bobby;

Again, I don't think any one understands that these are 2 spearate
executables. Monitor won't do it. It has to be something similar to MUTEX

but
will allow a certain number of executables to share the Connection to the
internet and will prevent which ever one completes first from hanging up

on
the second one. The MUTEX would only prevent one from dialing while the

other
one is dialing. The Semaphore tracks how many active transfers are going

on
simultaneously.

Please any more ideas.
--
Kenneth A. Jinks, Jr.
Lead Project Software Engineer
LabCorp CPG - LCM Development
Huntsville, AL

"bo*********@gm ail.com" wrote:
Maybe this link would be helpful to you
http://weblogs.asp.net/tspascoal/arc.../16/59340.aspx

Sincerely,
Bobby


Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1874
by: Nish | last post by:
Hi, I have some code, to which I added usage of posix semaphores. I am working on a solaris platform. After doing that, my process becomes unkillable, that is it will not terminate if sent a SIGTERM signal. I am not ignoring that signal. Just adding this code related to semaphores seems to be causing this problem. None of my threads is sleeping indefinitely on any semaphore wait. Any help will be appreciated. If this is not the...
1
2165
by: Mehmet Turker | last post by:
Hi; In a research project, I want to use shared memory with semaphores. First I have to create an environment for interprocess messaging. I'm thinking of having a main process which creates a big shared memory and manage all messages which are sent by objects inside the environment. Is this method effective for a high loaded messaging area? I heard about using ports can cause loss of data. And, is it ok to have a main process which will...
2
2289
by: schneider jp | last post by:
Hi everybody For a project of system programming, we need to use semaphores, but i got some pbs... when I compile, i get perror with sem_open("machin", O_CREAT, 0666, 0); and perror says function not implemented ... on a sun, i get perror : Invalid argument... another question : what's the max number of semaphores a process can create??
11
2999
by: FiLH | last post by:
Hello, I would like to know if posix semaphores are inter processes or just semaphores for threads inside the same process. I have not seen it defined in the posix specification I have found, but I have maybe missed something. Thanks in advance.
1
556
by: jinksk | last post by:
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...
1
4699
by: Edwin New | last post by:
I have a requirement to run two separate postmasters on the one machine. It looks like they compete for resources (semaphores) so won't run concurrently. I compiled twice, specifying different ports and home directories: ./configure --with-java --with-pgport=6100 --prefix=/usr/local/teprpg01 make etc...
5
2609
by: Steven Spencer | last post by:
Hi, I'm doing an IT degree at university, and my lecturer's do not teach m$ technologies. I was wondering if anyone could point me to the implementation of mutex's and semaphores in .net? Or the microsoft equivalent of them.
0
1144
arne
by: arne | last post by:
Hi, I am using Perl ithreads. The threads I create shall access a shared hash. In order to control access to the hash, I would like to use a semaphore. (BTW, does the hash need the protection at all if I can make sure that all threads use different keys?) Semaphores in Perl are provided by the (obsolete?) "Thread" module, which has been replaced by the "threads" module in recent versions. But in the latter, there are only locks, no...
0
1859
by: The Advocate | last post by:
Hello, how can we implement semaphores using monitors. I got how we can do it the way round. I did alot of search but couldnt find any implementation of semaphores using monitors,. Can anyone help me on this plz Thank you!
5
2698
by: davidcollins001 | last post by:
Hi, Firstly please excuse the long ramblingness. I need some conceptual help, I am trying to make two programs that are exactly the same but take it in turns to execute something, so the output looks something like the following: setup semaphores, etc . . proc 1 doing first thing proc 2 doing next thing
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.