Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Tearing Down a Callback 'Event' if the client has aborted

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 10-11-2006   #1 (permalink)
Jon
Guest


 

Tearing Down a Callback 'Event' if the client has aborted

Hi

I'm playing with the WCF and have created an eventing mechanism whereby the
server makes 'callback' events to the client. The client subscribes and
unsubscribes nicely with the server, so that a simple Timer event from the
service can notify client accordingly.

My question lies with the 'loss' of the client (say a crash) before
unsubscribing. When the server makes the callback to the now non-existent
client, a CommunicationObjectAbortedException is thrown. Does anyone know how
I remove the delegate to my non-existent client callback?

Thanks

Enclosed is a code extract from my 'Timer Service:


void tickTimer_Elapsed(object unused)
{
lock (this)
{
if (tick != null)
{
try
{
tick(null, EventArgs.Empty);
}
catch (CommunicationObjectAbortedException e)
{
// Remove eventhandler here as I have to assume the
Client has aborted!
// ************* ????????? ***************
}
}
}
}

/// <summary>
///
/// </summary>
public void Subscribe()
{
ITick subscriber =
OperationContext.Current.GetCallbackChannel<ITick>();
tick += subscriber.OnTick;
}

/// <summary>
///
/// </summary>
public void Unsubscribe()
{
lock (this)
{
ITick subscriber =
OperationContext.Current.GetCallbackChannel<ITick>();
tick -= subscriber.OnTick;
}
}


My System SpecsSystem Spec
Old 10-11-2006   #2 (permalink)
Arkady Frenkel
Guest


 

Re: Tearing Down a Callback 'Event' if the client has aborted

Even worse case when callback IsOneWay ( common use for callbacks) , I don't
receive notification up to the next retry.
The only way I can propose : to check Tcp table for client's port.
Arkady

"Jon" <Jon@discussions.microsoft.com> wrote in message
news:722F1587-BBF5-40D6-9268-9FE130648817@microsoft.com...
> Hi
>
> I'm playing with the WCF and have created an eventing mechanism whereby
> the
> server makes 'callback' events to the client. The client subscribes and
> unsubscribes nicely with the server, so that a simple Timer event from the
> service can notify client accordingly.
>
> My question lies with the 'loss' of the client (say a crash) before
> unsubscribing. When the server makes the callback to the now non-existent
> client, a CommunicationObjectAbortedException is thrown. Does anyone know
> how
> I remove the delegate to my non-existent client callback?
>
> Thanks
>
> Enclosed is a code extract from my 'Timer Service:
>
>
> void tickTimer_Elapsed(object unused)
> {
> lock (this)
> {
> if (tick != null)
> {
> try
> {
> tick(null, EventArgs.Empty);
> }
> catch (CommunicationObjectAbortedException e)
> {
> // Remove eventhandler here as I have to assume the
> Client has aborted!
> // ************* ????????? ***************
> }
> }
> }
> }
>
> /// <summary>
> ///
> /// </summary>
> public void Subscribe()
> {
> ITick subscriber =
> OperationContext.Current.GetCallbackChannel<ITick>();
> tick += subscriber.OnTick;
> }
>
> /// <summary>
> ///
> /// </summary>
> public void Unsubscribe()
> {
> lock (this)
> {
> ITick subscriber =
> OperationContext.Current.GetCallbackChannel<ITick>();
> tick -= subscriber.OnTick;
> }
> }
>



My System SpecsSystem Spec
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
How Can a Server Raise an Event at a Client (Remoting) Charles Law .NET General 10 07-28-2008 05:16 PM
IE 7 Runonce Operation Aborted and other errors. Purtech Vista General 0 08-19-2007 01:35 PM
Event callback on thread William Stacey [C# MVP] PowerShell 3 12-12-2006 07:57 PM
Download aborted at 91% =?Utf-8?B?UmVwbGF5?= Vista General 9 10-09-2006 12:03 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51