![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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) |
| | 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 | |
| |
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 | |||