views:

135

answers:

1

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.

A: 

I believe I figured out the answer. I had an exception that was not bubbling (due to the One-Way operation contract) and that would take down that instance. Once it was down no more messages would work. It would be nice it MS would at least put these exceptions on the output stack. Now that I handle the errors gracefully, the messages to go to all the clients. One thing to note is that if you are using a one-way contract, you cannot bubble exceptions to the client in any way. I guess I understand, since if 4 peers had exceptions, which exception would you get (all 4?) So I guess it makes sense that in a peer mesh where the messages are broadcast, that you cannot get replies of any kind.