1

I'm trying to register a peer name using code, and be able to resolve the peer on another machine. My first attempt is to get it working on my own network, but want to get it working globally.

Update: Seems to be failing to add a registration. I can register via commandline on my other machine and resolve it on the other.

I know this is a big vague, but will answer questions.

I also have been reviewing the follow links for troubleshooting ideas:

http://blogs.msdn.com/b/p2p/archive/2007/07/24/pnrp-debugging-guide-part-1.aspx

http://blogs.msdn.com/b/p2p/archive/2007/06/15/pnrp-and-pnrp-net.aspx

I'm using the following command to resolve, but only works on the local machine:

netsh p2p pnrp peer resolve peername=0.AMS cloud=Global_

Here's the code i'm using:

Imports System
Imports System.ServiceModel
Imports System.ServiceModel.Description
Imports System.Net
Imports System.Net.PeerToPeer

Module Module1

    Sub Main()

        Dim reg As PeerNameRegistration = RegisterPeer("AMS", 8000)
        reg.Cloud = PeerToPeer.Cloud.Global
        reg.Comment = "Hello!"
        reg.Start()

        Console.WriteLine("Please press 'Enter' to exit...")
        Console.ReadLine()
    End Sub

    Public Function RegisterPeer(ByVal classifier As String, ByVal port As Integer) As PeerNameRegistration
        Dim peerName As PeerName = New PeerName(classifier, PeerNameType.Unsecured)
        Dim reg As New PeerNameRegistration(peerName, port)
        reg.UseAutoEndPointSelection = True
        Return reg
    End Function

End Module

0 Answers0