WCF App using Peer Chat app as example does not work.

Posted by splate on Stack Overflow See other posts from Stack Overflow or by splate
Published on 2010-05-01T15:21:33Z Indexed on 2010/05/01 15:27 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

I converted a VB .Net 3.5 app to use peer to peer WCF using the available Microsoft example of the Chat app. I made sure that I copied the app.config file for the sample(modified the names for my app), added the appropriate references. I followed all the tutorials and added the appropriate tags and structure in my app code. Everything runs without any errors, but the clients only get messages from themselves and not from the other clients. The sample chat application does run just fine with multiple clients. The only difference I could find is that the server on the sample is targeting the framework 2.0, but I assume that is wrong and it is building it in at least 3.0 or the System.ServiceModel reference would break. Is there something that has to be registered that the sample is doing behind the scenes or is the sample a special project type? I am confused. My next step is to copy all my classes and logic from my app to the sample app, but that is likely a lot of work.
Here is my Client App.config:

        <client><endpoint name="thldmEndPoint" 
                            address="net.p2p://thldmMesh/thldmServer"
            binding="netPeerTcpBinding" 
                            bindingConfiguration="PeerTcpConfig"
            contract="THLDM_Client.IGameService"></endpoint></client>
    <bindings><netPeerTcpBinding>
            <binding name="PeerTcpConfig" port="0">
                <security mode="None"></security>
                <resolver mode="Custom">
                    <custom address="net.tcp://localhost/thldmServer" binding="netTcpBinding"
                bindingConfiguration="TcpConfig"></custom>
                </resolver>
            </binding></netPeerTcpBinding>
        <netTcpBinding>
            <binding name="TcpConfig">
                <security mode="None"></security>
            </binding>
        </netTcpBinding>
    </bindings>

Here is my server App.config:

        <services>
        <service name="System.ServiceModel.PeerResolvers.CustomPeerResolverService">
            <host>
                <baseAddresses>
                    <add baseAddress="net.tcp://localhost/thldmServer"/>
                </baseAddresses>
            </host>
            <endpoint address="net.tcp://localhost/thldmServer" 
                                binding="netTcpBinding"
              bindingConfiguration="TcpConfig"
              contract="System.ServiceModel.PeerResolvers.IPeerResolverContract">
            </endpoint>
        </service>
    </services>
    <bindings>
        <netTcpBinding>
            <binding name="TcpConfig">
                <security mode="None"></security>
            </binding>
        </netTcpBinding>
    </bindings>

Thanks ahead of time.

© Stack Overflow or respective owner

Related posts about wcf

Related posts about peer-to-peer