Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 8:21
mvaMarc Clifton9-Feb-04 8:21 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
LongRange.Shooter9-Feb-04 8:26
LongRange.Shooter9-Feb-04 8:26 
AnswerRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen9-Feb-04 10:30
Tom Larsen9-Feb-04 10:30 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 10:58
mvaMarc Clifton9-Feb-04 10:58 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen9-Feb-04 11:37
Tom Larsen9-Feb-04 11:37 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 13:30
mvaMarc Clifton9-Feb-04 13:30 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen10-Feb-04 7:04
Tom Larsen10-Feb-04 7:04 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
LongRange.Shooter10-Feb-04 9:08
LongRange.Shooter10-Feb-04 9:08 
I just jumped into this conversation.

I assume that the change of priveledge (or whatever the change is) occurs via a method (or collection of methods) executed on the server. To guarantee that only one gets at the object, and only one, yet users are not blocked, then just use the lock{} command.

public bool UpdateThePriveledge(object orignalValue, object newValue)
{
  lock
  {
     try{
        res = new LimitedRemoteResource();
        res.Allocate();
        this.MethodDoesSomething(res,argsA);
        this.SomeOtherMethodDoesSomething(res,argsB);
        ....
       // somewhere along the way the application goes poof!
       // I hate when that happens
        ....

  }
  finally
  {
       // if something really bad happens this doesn't get called anyway
       if(res != null)
         res.Release();
  }
 }

 public bool PublishIdentity(string name)
 {
 }
 public void NotifyServer(string name)
 {
 }


The lock will single thread, yet outstanding users will wait for the unlock. This is the standard way to make multi-updates thread-safe. Even if the code craps out, once you leave the method via the finally{}, you will unlock the method for the next user.

The NotifyServer call is what I mean by 'pinging' the server. If you can remote to call UpdateThePriveledge, you can call to NotifyServer that you are alive. No real 'ping' is meant here.

_____________________________________________
Of all the senses I could possibly lose,
It is most often the one called 'common' that gets lost.

GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen11-Feb-04 3:53
Tom Larsen11-Feb-04 3:53 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
HAHAHA_NEXT9-Feb-04 11:01
HAHAHA_NEXT9-Feb-04 11:01 
QuestionHow to get/set printer paper media type Pin
trythat9-Feb-04 5:55
trythat9-Feb-04 5:55 
QuestionDynamic attributes for propertyGrid??? Pin
LongRange.Shooter9-Feb-04 3:11
LongRange.Shooter9-Feb-04 3:11 
AnswerRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart9-Feb-04 4:17
protectorHeath Stewart9-Feb-04 4:17 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter9-Feb-04 8:09
LongRange.Shooter9-Feb-04 8:09 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart9-Feb-04 9:33
protectorHeath Stewart9-Feb-04 9:33 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter9-Feb-04 10:38
LongRange.Shooter9-Feb-04 10:38 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart9-Feb-04 14:02
protectorHeath Stewart9-Feb-04 14:02 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter10-Feb-04 8:58
LongRange.Shooter10-Feb-04 8:58 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart10-Feb-04 11:18
protectorHeath Stewart10-Feb-04 11:18 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter11-Feb-04 7:49
LongRange.Shooter11-Feb-04 7:49 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart11-Feb-04 9:14
protectorHeath Stewart11-Feb-04 9:14 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter11-Feb-04 10:45
LongRange.Shooter11-Feb-04 10:45 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart11-Feb-04 11:53
protectorHeath Stewart11-Feb-04 11:53 
GeneralCommand Line Pin
GetOn&GetGoing8-Feb-04 23:43
GetOn&GetGoing8-Feb-04 23:43 
GeneralRe: Command Line Pin
Heath Stewart9-Feb-04 1:30
protectorHeath Stewart9-Feb-04 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.