I am writing a program that needs to establish a direct peer to peer connection between clients. The easiest solution would be to set up port forwarding, but since the program is intended for a more general audience, I want to keep extra configuration to a minimum. I want to try hole punching but I don't understand it very well. Does anyone have any experience with such things? Am I approaching this problem the wrong way?
UPnP IGD and/or NAT-PMP. You can ask the NAT device (if there is one) to open a port for you (provided that's permitted by device policy).

Less messy than hole-punching and probably easier as well if you use an existing library.
Tari wrote:
UPnP IGD and/or NAT-PMP. You can ask the NAT device (if there is one) to open a port for you (provided that's permitted by device policy).

Less messy than hole-punching and probably easier as well if you use an existing library.


I'll take a look at those links. Why is hole punching messy? What if the router doesn't support NAT-PMP?
(I was reminded that this thread exists..)

I dislike hole punching simply because you're doing things in a way the system wasn't designed to operate. The mechanism exists to ask the router to open a port for you, so you should use it if possible.
What if you have two routers?
What configuration are you worried about exactly? Nested NATs? Or that the person you're communicating with is also behind a NAT?
Hitechcomputergeek wrote:
What if you have two routers?

I can't tell if you're trying to instigate some kind of e-peen contest or just have an unusual question. Razz

No real difference in that case. You must to bind to only one external address to have any hope of sensible (reliable) communication unless you're using a multihome protocol, in which case you're aware of this sort of situation by design. Thus you'll simply bind to an address and open a port as usual.
No, just on my home network, the modem (ZyXEL EQ-660R), for some odd reason, has built-in router capabilities. The router and modem both have firewalls, and both support UPnP. Problem is, I can set up port forwarding on the router and modem, but UPnP won't work. I think that for it to work, the router would both have to open the port when it sees the UPnP request AND pass the UPnP request onto the modem.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement