WCF作为服务端,c++写的客户端通过socket连接,WCF服务端能接收字节流吗?如何实现?这种用法可能比较邪门,不要见笑! 
我听说WCF底层用的完成端口,支持很大连接,发送数据速度也很快。我就想利用这一点优势。

解决方案 »

  1.   

    貌似NetTcpBinding 要求服务器和客户端都使用WCF才行
      

  2.   

    定,到底行不行啊?WCF是很灵活的,理论上应该可以的,谁给个示例!
    C++发送多少个字节,WCF服务端能接收多少个字节,只要这个功能就可以了。
      

  3.   

    那你为什么客户端不用WCF呢,会简单很多。WCF支持下列binding
    Name               Transport            Encoding               Interoperable
    BasicHttpBinding   HTTP/HTTPS           Text, MTOM             Yes
    NetTcpBinding      TCP                  Binary                 No
    NetPeerTcpBinding  P2P                  Binary                 No 
    NetNamedPipeBinding IPC                 Binary                 No
    WSHttpBinding      HTTP/HTTPS           Text, MTOM             Yes 
    WSFederationHttpBinding  HTTP/HTTPS     Text, MTOM             Yes
    WSDualHttpBinding  HTTP                 Text, MTOM             Yes
    NetMsmqBinding     MSMQ                 Binary                 No
    MsmqIntegrationBinding MSMQ             Binary                 Yes看起来NetTcpBinding最符合你的需要,可是
    Having a text-based encoding enables a WCF service (or client) to communicate over HTTP with any other service (or client) regardless of its technology. Binary encoding over TCP or IPC yields the best performance but at the expense of interoperability, by mandating WCF-to-WCF communication.binary只支持WCF-to-WCF,除非你自己用C++实现一个WCF 
      

  4.   

    You'll basically need to create the request exactly as the server would expect, and parse the response afterwards. There's some information here: http://blogs.msdn.com/carlosfigueira/archive/2008/01/13/writing-custom-requests-to-simple-wcf-services.aspx
      

  5.   

    能不能给个具体例子啊!我现在也在用c++通过socke调用WCF服务采用NetTcpBinding 绑定。
    牛人解答啊