![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| 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 |