コードを使用してピア名を登録し、別のマシンでピアを解決できるようにしようとしています。私の最初の試みは、自分のネットワークで動作させることですが、グローバルに動作させたいと考えています。
更新: 登録の追加に失敗しているようです。他のマシンでコマンドライン経由で登録し、他のマシンで解決できます。
これが非常に曖昧であることは承知していますが、質問に答えます。
また、トラブルシューティングのアイデアについて、次のリンクも確認しています。
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
次のコマンドを使用して解決していますが、ローカル マシンでしか機能しません。
netsh p2p pnrp ピア解決ピア名 = 0.AMS クラウド = Global_
私が使用しているコードは次のとおりです。
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