[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Unsuscribing not valid remote event clients

neo [mvp outlook]

10/1/2004 3:59:00 PM

Is there any way I can remove the link or unsuscribe not valid clients?
I have a try catch in the event invocation on the server, if the server can
not raise the event, will log its fail, but i dont want the server to try
again with the same invalid client.


2 Answers

Ryan Berry

10/1/2004 4:31:00 PM

0

As Ken had suggested for another author: Please read the following
article regarding remoting and events:

http://www.dotnetjunkies.com/Tutorial/BFB598D4-0CC8-4392-893D-30252E2...

Here's a very simple example you would place into you're event handler:

if (_OnEvent!=null)
{

System.Delegate[] oClientList;


lock (OnEvenSyncObject) // a generic object to prevent additions to
the chain while we're looping
{
oClientList = _OnEvent.GetInvocationList();
}


for (int iLcv=0;iLcv<oClientList.Length;iLcv++)
{
EventDelegate del = (EventDelegate) oClientList[iLcv];
try
{
// Try to invoke the delegate -- remove from list if it fails
del();
}
catch (Exception)
{
oClientList -= del;
}
} // End chained event enum
}

-- Ryan Berry
rtberry@gmail-no-spanmmers-please.com

neo [mvp outlook]

10/19/2004 4:59:00 PM

0

Thank you, I read the article and my problem was solved.

Sorry for the delay on my answer.

"Ryan Berry" wrote:

> As Ken had suggested for another author: Please read the following
> article regarding remoting and events:
>
> http://www.dotnetjunkies.com/Tutorial/BFB598D4-0CC8-4392-893D-30252E2...
>
> Here's a very simple example you would place into you're event handler:
>
> if (_OnEvent!=null)
> {
>
> System.Delegate[] oClientList;
>
>
> lock (OnEvenSyncObject) // a generic object to prevent additions to
> the chain while we're looping
> {
> oClientList = _OnEvent.GetInvocationList();
> }
>
>
> for (int iLcv=0;iLcv<oClientList.Length;iLcv++)
> {
> EventDelegate del = (EventDelegate) oClientList[iLcv];
> try
> {
> // Try to invoke the delegate -- remove from list if it fails
> del();
> }
> catch (Exception)
> {
> oClientList -= del;
> }
> } // End chained event enum
> }
>
> -- Ryan Berry
> rtberry@gmail-no-spanmmers-please.com
>
>