one instance of application on network

S

Sam

Hi,
I know how to allow only one instance of my .net application per user
using mutex.
Now I want to warn the user if someone else is using the application on
another pc of the same network.
How can I implement that ?

Thanks
 
G

Guest

Do it the MS way, everytime your application opens, run a temp file to
sustain variables during the duration. When the application is opened a
second time it looks before creating the file, if the file exists, then you
can code for what you want to happen when more than one person is using the
program.

Randy
 
S

Sam

Hi Randy,
Thank you for your reply.

Where should I create the temp file? Probably not on local machine
right?
 
C

Cor Ligthert [MVP]

Sam,
Thank you for your reply.

Where should I create the temp file? Probably not on local machine
right?

No this is a solution using a Network share, however it is a deadly
solution, just because of the deadlock

The idea is to create a token as a program opens and remove that when it
closes. But if the user in a network environment (and I have seen a lot of
those), just put the power down than you have a deadlock.

If you really want this than is in my idea the only solution to build
service mechanisme using remoting that polls everytime the program that has
told that he is busy. A real expensive mechanisme (to build) in my opinion.
I do not have a sample for you and never did this.

Just as idea,

Cor
 
M

m.posseth

Well i have built a mechanism like this ,,, and it turned out to be quit
simple

on start of your program just let it broadcast a wakeup message ( with a
signature you provide ) , your program already running listens for incoming
messages with this specific signature and returns a apropriate message

i used this for a remoting project ,,, however before i started the remote
object from the client i wanted to make sure that

1. a remoting server was running and wich version
2. what the settings were for the remote server ( ip adress , port number )
3. wich server was the most powerfull server
4. wich server had the lowest load

so i implemented a broadcast mechanism on the UDP protocol ,,, i can write a
small example for you if you want
tell me wich version you use of VS.Net ( 2003 or 2005 ) this for testing
purposes of the test proggy ( as i use the code in both versions without a
change )

regards

Michel Posseth [MCP]
 
M

m.posseth

just to be sure you understand what i mean

the starting new program starts , performs a broadcast ( annybody out there
?? )
the already running program listens on a specific port and receives this
message and answers ( yes i am here )

the starting program now nows it can show a message to the user and quit

this technique is the safest way in my opinion ( can`t deadlock )

the implementation is verry simple ( a few lines of code .... 130 to be
exact :)

regards

Michel Posseth [MCP]




m.posseth said:
Well i have built a mechanism like this ,,, and it turned out to be quit
simple

on start of your program just let it broadcast a wakeup message ( with a
signature you provide ) , your program already running listens for
incoming messages with this specific signature and returns a apropriate
message

i used this for a remoting project ,,, however before i started the remote
object from the client i wanted to make sure that

1. a remoting server was running and wich version
2. what the settings were for the remote server ( ip adress , port
number )
3. wich server was the most powerfull server
4. wich server had the lowest load

so i implemented a broadcast mechanism on the UDP protocol ,,, i can write
a small example for you if you want
tell me wich version you use of VS.Net ( 2003 or 2005 ) this for
testing purposes of the test proggy ( as i use the code in both versions
without a change )

regards

Michel Posseth [MCP]



Sam said:
Hi,
I know how to allow only one instance of my .net application per user
using mutex.
Now I want to warn the user if someone else is using the application on
another pc of the same network.
How can I implement that ?

Thanks
 
S

Sam

Hi Michel,
Woah, that sounds good! Except I don't know much about network
programming:-( I wouldn't mind an example indeed if you have time for
that! But I understood the theory at least, thanks to your
explanations.

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top