Folks, I have to write a client-server app where the server is a WCF service
over tcp binding and the clients are WinForms apps on the LAN. I have to
implement callbacks to clients so that if one client updates the database
then the server can broadcast this to all clients.

 

I've done this previously with Remoting and the trick is to call a service
method like Login(user,password,callback) where callback is a
MarshalByRefObject which implements a callback method. The server has to
keep a collection of these callbacks and then loop through them to broadcast
back to the clients. The error handling is a bit fiddly but overall it works
very well. It works because the channels to the clients are open and I can
call back over them at any time.

 

I can't figure out how to implement the same behaviour in WCF. I'm confused
by the lifetime of the channels and I don't know how to broadcast back to
all clients. I don't even know what to hold in a collection on the server
side to reference the client's callbacks. I'll keep web searching in the
meantime for a sample of what I want, but it might waste a lot of time and I
was wondering if anyone here has done this with WCF before. Any advice would
be most welcome. I'll post the answer back if I ever find it.

 

Cheers,

Greg

Reply via email to