3

What I am trying to do is p2p chat app, fair and simple. It uses one program in multiple instances on one or multiple computers. So no specific "server/host" app. Also note that I am not using peer channel.

So this is my service host inside the chat app:

        //wcf host
        WCFService srvc= new WCFService();

        tcpUri = new Uri(string.Format("net.p2p://{0}:{1}/ProjectSandSevice", peerName.PeerHostName, port));

        NetPeerTcpBinding tcpPeerBinding = new NetPeerTcpBinding();
        tcpPeerBinding.Security.Mode = SecurityMode.None;
        tcpPeerBinding.Resolver.Mode = System.ServiceModel.PeerResolvers.PeerResolverMode.Pnrp;

        host = new ServiceHost(srvc);
        host.AddServiceEndpoint(typeof(IWCFService), tcpPeerBinding, tcpUri);
        host.Open(); 

PeerHostName (DNS name) is unsecured and it looks like this "hatest-hna3l.p0.pnrp.net". So sometimes when chat app is running on different machine behind different NAT (router) it does not work (PNRP finds it, but WCF cannot connect). I think it is because of repetitive unsecured DNS name. Note that this sometimes WORKS and sometimes DOES NOT!

So I was thinking to use 2 PNRP registered peer names, one unsecured (for PNRP resolving), and one secured (thus having much more unique host name than "hatest-hna3l.p0.pnrp.net") for actually hosting WCF service.

Please tell me what you think about this approach and will it solve my problem of unreliable WCF connection.

Cœur
  • 37,241
  • 25
  • 195
  • 267
TheBojanovski
  • 137
  • 1
  • 7

0 Answers0