Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 882551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:26:39+00:00 2026-05-15T12:26:39+00:00

As writen in my title, background: I have 2 different type of applications (WPF-silverlight)

  • 0

As writen in my title,

background:
I have 2 different type of applications (WPF-silverlight) which can talk each other – Doctor application and Patient application – but it doesn’t mean only 2 apps will run, for instance:
i can run 3 doctor app and 7 patient app.
and all of those apps is communicate using wcf via tcp connection.
the communication is real time (like messenger app)

flow
everytime there’s an app online(run) i registering its connection at wcf, because i need to let the other apps know (real time) there’s new client connected or there’s new client disconnected.

problem:
it’s fine to let the other app know that there;s incoming app/client,
but my problem is, how to let the other app know if this client was disconnected,

it’s fine if the user close the application properly (eg. click the close button) – so in wpf, i can call the wcf to unregister the connection,

but how if the connection was terminated abnormal (eg. directly unplug your pc’s power cable)
is there any way for me to know this client still connected or not?

i realize this problem when i pres f5 in my VS2008 and close, and open again and close (repeated) and then, when i debug, there’s a lot of connection is still stored there but actually the client is already destroyed.

so anybody have know this best solution?
example is much appreciated

my code snippet:

Dictionary<Guid, Client> Connections = new Dictionary<Guid, Client>();
// above is the variable where i put the connections
    object syncObj = new object();

    public ITcpServiceCallback CurrentCallback { get { return OperationContext.Current.GetCallbackChannel<ITcpServiceCallback>(); } }

    // this function is called when the program started
    public List<Client> ShakeHand( Client client, RoleType appType ) {
        if( GetClientsByCallback( CurrentCallback ).Count < 1 && GetClientsByID( client.ID ).Count < 1 ) {
            List<Client> retVal = new List<Client>();
            lock( syncObj ) {
                if( appType == RoleType.Doctor ) {
                    List<Client> doctors = Helpers.GetDoctor( AppDomain.CurrentDomain.BaseDirectory + "App_Data/doctor.xml" );
                    foreach( Client doctor in doctors ) {
                        doctor.Status = ConnectionStatus.Offline;
                        foreach( Client con in Connections.Values ) {
                            if( con.Role == RoleType.Doctor && con.ID == doctor.ID ) {
                                doctor.Status = ConnectionStatus.Online;
                                break;
                            }
                        }
                        retVal.Add( doctor );
                    }
                } else { //b la.. bla similiar like if above
                }

                client.Callback = CurrentCallback;
                client.Status = ConnectionStatus.Online;

                // this is the code where i add the connection
                Connections.Add( Guid.NewGuid(), client ); 

            }
            return retVal;
        }
        return null;
    }

Thank you in Advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:26:39+00:00Added an answer on May 15, 2026 at 12:26 pm

    I think what you really need to implement is a publisher / subscriber service. All the doctor and patients applications have a link to the pub/sub service. When one an application starts up, it subscribes to the service and begins receiving notifications from all the other applications. When an application closes it unsubscribes from the events.

    Take a look at this:
    http://msdn.microsoft.com/en-us/library/ms752254.aspx

    and this:
    http://msdn.microsoft.com/en-us/magazine/cc163537.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a code which does the thing as the title says. The
I've so far made a html and css file which have three images; title,
The title pretty much says it but here is some background: I have an
On my website, I have an upload story feature with a user written title
As I had written in title, I have SQL query, run on Oracle DB,
Some users like to write post title all in uppercase, which is completely annoying.
(Sorry for strange title, haven't come up with anything better..) Background I use nunit-console
I have a question about Objective-C today involving NSMutableArray. Coming from a .net/c# background
My background has been generally new technology demonstrators, which, well... demonstrate the latest technology
I have a table that is 26 squares by 26 squares. Each square is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.