Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

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

 
 
Old 10-11-2006   #1 (permalink)
Jon


 
 

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


 
 

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


Similar Threads
Thread Forum
Event ID 1002 — DHCP Client Address Conflicts Vista General
Event 1103: DHCP Client Network & Sharing
How Can a Server Raise an Event at a Client (Remoting) .NET General
Event callback on thread PowerShell


Vista Forums 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 Ltd

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