Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recover Callback channel after CommunicationObjectAbortedException thrown

We have (Multiple)Clients-(One)Server architecture for poker desktop game. We are using callback Notifications using callback Channels.

But sometimes because of internet connection drops, that particualr client gets disconected from server and that particular's client's WCF channel is also gone to faluted state and his callback Channel which lies in server is also faluted.

Scenario :

That client is playing game, while internet connection drops, that game is stopped, still his game window remains open and when his/her internet connection gets back that client is dropped out from Server, but that player's game window still opens and that player can't do anything as his/her WCF channel is dropped out.

We want to close that particular client's window while he/she is dropped out from server and throwing 'CommunicationObjectAbortedException ' exception.

We can't use previous WCF channel's callback channel as it's in faluted state. So we have tried to create new callbackChannel in server while dropping using below code :

OperationContext.Current.GetCallbackChannel();

but here Current is showing "NULL" as that player's WCF channel is aborted, so it's throwing an error that "Object reference not set to an instance of object".

So is there any solution to use aborted WCF channel's callback Channel or recover that WCF channel without reinitializing them or to call that client using new channel?

like image 403
KomalJariwala Avatar asked Nov 12 '22 19:11

KomalJariwala


1 Answers

I'd try following:

  1. On server side, when trying to communicate using faulted / aborted chanel - you'll failed. Catch this failure, and remove its callback from the list (I suppose you manage some callback list).

  2. On client side - when chanel Faulted / ... handled - try to re-open new chanel to server. When this new chenel will be open, on server side place this new callback back to the "valid callbacks" list.

like image 74
evgenyl Avatar answered Nov 15 '22 06:11

evgenyl