Andrew Carl
Andrew Carl

Reputation: 822

WCF Duplex service VS Socket based on TCP

I'm working on a project including WCF server and remoting clients.Now the necessary functional part of the software need to push message from server to specified client.

I know that Socket can achieve this, but I want to use WCF Only. So I find document on WCF duplex service.Here is my idea:

  1. I start a new thread which communicate with duplex service only once and then wait for the callback from the server.(Keep the thread alive and let the proxy opened for waiting the callback )
  2. At the server side,I save all the clients' callbackInstance in a List,and once I want to invoke callback on the specified client,I will take the callbackInstance out from the List and invoke the callback method.

Question

  1. Is my idea feasible?
  2. If question one is yes,how to detect whether the client is still alive(Prevent from invoking the callback on a client-proxy which is closed. )
  3. Is this something we can replace Socket in WCF Service? Thanks a lot.

Upvotes: 0

Views: 302

Answers (1)

Noctis
Noctis

Reputation: 11763

  1. Everything is feasible ... It's all a question of what you know, what's involved, and how much time/money you have.

  2. I haven't worked much with duplex WCF because I had to use one way in webservices, but another approach is using a framework like XSockets . It's version 4 is in beta ATM, but the developers are quite approachable and active, so if you have any issues, they'll be happy to work.

It'll give you real time communication in both direction with one to one or one to many, and might fit your use case ...

Upvotes: 1

Related Questions