How to create a simple WCF service with a TCP/IP duplex connection?
I'm trying to learn how to create a web service that is capable of both sending and receiving data.
As an example I have defined a ServerTimeService:[ServiceContract]
public interface ServerTimeService
{
[OperationCon开发者_开发技巧tract]
DateTime GetServerTime();
[OperationContract(IsOneWay = false)]
DateTime SendServerTime();
}
Now I am told I should be providing a callback contract, but I really don't get why or what it is? When is the callback contract called?
Further more I'd like to see a code exmple sending the server time and receiving it at the client.Here's another simple duplex example that outlines the basics pretty well. An example project is included. http://realfiction.net/2008/01/30/the-no-frills-bare-bones-example-to-duplex-wcf
精彩评论