Tags

About Me

I'm Rolf Kaiser. I've ridden the wave from 3-guys-in-a-garage, to an acquisition by a big software company, and have built a string of startups since. This blog is a little compendium of tips and tricks so hopefully the next guy doesn't have to reinvent the wheel.

P.S. the tagline is a sailing reference.

Tag: P2P

A few months ago I investigated various options to build P2P apps that could be run across the internet, regardless of hardware and ISPs.

The research started with Java, which is JXTA (aka Juxtapose) – the framework started by Sun in 2001. I suspect the open-source P2P filesharing clients all use it (since they all seem to be Java). It has been ported to C/C++ (which I was eventually able to compile on Win32). I was unable to get the .NET wrapper running (which is known to be incomplete anyway).

Thus I was stuck. Research continued and I eventually got to the WCF P2P framework. I’m not sure of the additions in 3.5 vs. 3.0. For starters check out:

That said, is this supposed to be possible for 3rd-party developers? See my forum post where I asked around – net consensus was “sort of”, which I eventually confirmed. Read on.

Running the PNRP service

PNRP is the name resolution protocol. Service is running by default on Vista, but if it’s not do this. On XP, you need the Advanced Networking Pack (if you’re pre-SP2). If you are SP2+, you get it but need to enable it. But according to this post, though, maybe SP2 doesn’t get it for free after all? Who knows.

From a command shell prompt, start the PNRP service with the following command: net start pnrpsvc.

Then you can check install by running

> netsh p2p pnrp cloud show list

You should see at least a link local and a global PNRP cloud. If you’re missing the Global_ cloud, you’ll need to take some extra steps to get IPv6 working. In that case see this debugging guide.

Troubleshooting the PNRP service

If you run:

> netsh p2p pnrp cl sh st *

and get:

Scope Id Addr State Name
----- ----- ----- ---------------- -----
1 0 1 Virtual Global_
Synchronize server: pnrpv2.ipv6.microsoft.com;pnrpv21.ipv6.microsoft.com
Use Server: Not used
Use SSDP: Not used
Use Persisted cache: Not used
Scope Id Addr State Name
----- ----- ----- ---------------- -----
3 4 1 Virtual LinkLocal_{C3D2D7B6-FEF3-4CA2-9238-4EC716
142528}
Synchronize server:
Use Server: Disabled
Use SSDP: Not used
Use Persisted cache: Not used

then run

> netsh p2p pnrp cloud start Global_

Opening ports in the firewall

Manually opening ports (may not be needed).The above steps seem to set up PNRP outside the Windows Firewall (since they don’t show as exceptions). 3rd party products like Norton could be another story. The ports necessary to be open are TCP (2869) and UDP (1900).

Allowing edge traversal in the firewall rule

(Vista only) The first time you run a PNRP-enabled executable you should get a Windows Firewall warning. That’s all you need for XP, but this however is not sufficent if you’re on Vista! As per the answer on this post, then open up the Windows Firewall Advanced control panel, select the UDP rule that just got created, right-click to get the properties, and then under the Advanced tab, check “Allow edge traversal”. Then OK out and repeat for the TCP rule.

This blog posting has a technique for piping WCF debug output to a file. Immensely helpful. The file can be viewed by the ServiceTraceViewer, a tool located in “C:\Program Files\Microsoft SDKs\Windows\v6.1\bin\”