UDP Hole Punching Demo

  • Thread starter Thread starter Hans Peter Gerdes
  • Start date Start date
H

Hans Peter Gerdes

Hi there,

is there any UDP hole Punching Demo with the .Net Framework out there?
Thanks for answer

Hans Peter.
 
Hans Peter Gerdes said:
is there any UDP hole Punching Demo with the .Net Framework out there?

I don't know. But there's nothing special about "hole punching" that would
require a demo in .NET per se. A normal socket sample using .NET should
suffice as far as demonstrating UDP techniques with .NET. One would just
apply the desired hole punching technique using the .NET socket API (for
most applications, this simply means to make the necessary datagram
transmissions to an appropriate target, remembering of course that the
actual outcome of the technique is dependent on the particular NAT
implementation in use).

Pete
 
Pete,
thanks for answer.
I searching for a sample source, because i am not a Socket and NAT
specialist, but i can read a lot out of the source. ;-)

Hans Peter
 
Hans Peter Gerdes said:
Pete,
thanks for answer.
I searching for a sample source, because i am not a Socket and NAT
specialist, but i can read a lot out of the source. ;-)

Not that this is .NET specific (so this is pretty off-topic here), but here
are some resources that you may find helpful.

Winsock FAQ (.NET sockets are basically just Winsock with .NET wrapper):
http://tangentsoft.net/wskfaq/
Also, the FAQ covers a variety of basic UDP techniques with samples.

A paper that was recently presented on the topic:
http://www.usenix.org/events/usenix05/tech/general/full_papers/ford/ford_html/index.html
Note: the basic idea behind hole punching is simple...two peers both contact
a common third-party, who then provides destination information to each
peer. The peers then attempt to contact each other...in most cases, as long
as they use the same IP address and port that the common third-party was
using for each, the NAT router will route the UDP datagrams appropriately.

Wikipedia even has an article on the topic:
http://en.wikipedia.org/wiki/UDP_hole_punching

Of course, MSDN has some sample code with respect to use of UDP sockets in
..NET. But UDP sockets are pretty straight-forward. Make a datagram and a
Socket to send with, use SendTo to send it to a particular address (IP and
port), and use ReceiveFrom to receive a datagram from someone else.

One final comment: IMHO, hole-punching is not a very good technique to rely
on. There is talk of creating a standard that NAT routers can follow, but
IMHO the existing standard of Universal Plug-and-Play addresses these issues
reasonably well without relying on undefined behavior from the NAT router
(and I'd guess that at least as many NAT routers implement UPnP as can be
relied upon to support hole-punching).

Pete
 
Back
Top