Reputation: 1336
I'm trying to do port forwarding to my project as a replacement to the current udp hole punching. The reason is because I want clients to start communication with each other without the server intervention. In .net we can use natupnplib, but it doesn't seem to work properly (it doesn't work on wifi at my home, for example). Mono.Nat doesn't seem to be the solution as well.
I know that there is a way to do that, because uTorrent does port mapping on every pc I checked. (I know it might not be compatible everywhere, but I want it to work in devices that uTorrent works in)
I've looked over the internet for open-source bittorents implementation for port forwarding, but haven't found. A solution written in .net environment would be great. So, how do I do it? :)
Upvotes: 4
Views: 4937
Reputation: 5275
You can do port forwarding in your .NET project using UPNP and/or PMP (or its newer version, PCP - Port Control Protocol). Currently, most of the available devices support UPNP even when it is disabled by default in many of them.
There are a couple of reasons why some libraries don't work properly in you wifi. First of all, be sure you have enabled upnp in your NAT device. If it is enabled then, probably the libraries that you tested only support IP routes (WANIPConnection) and doesn't support ADSL modems (WANPPPConnection).
The official Mono.Nat only works for devices than support WANIPConnection (IP routers) however there are lots of devices (home devices) that allow only WANPPPConnection (ADSL modems - this can be your case). However you can use one of its better mantained forks which already support WANPPPConnection.
If you use .NET 4.5, I recommend Open.NAT (yes, it was developed by me), it works with home devices, is faster and newer than Mono.Nat.
Good luck!
Upvotes: 7