开发者

How to create a simple WCF service with a TCP/IP duplex connection?

开发者 https://www.devze.com 2023-02-09 02:31 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消