Questions tagged [hole-punching]

Hole punching is the process of taking advantage of the standard way of implementing NAT to allow direct connection between computers in private networks.

The process starts as normal proxy - two devices connect to the same public server:

image description

The data flows through public server. The green circles represent the socket connections between devices, the blue line is the flow of data.

Now what it the server sends socket A to device B and vice versa?

image description

Suddenly, both devices have each other's "address" and can send any information to each other:

image description

181 questions
37
votes
2 answers

UDP hole punching not going through on 3G

I'm trying to implement in a software a hole punching feature. The thing is, I'm implementing this with an already made TCP Server to communicate with Users. Here's what I have so far : "A" sends a message to an UDP Server "US" (on port 9333) "US"…
TheSquad
  • 7,385
  • 8
  • 40
  • 79
36
votes
4 answers

Java UDP hole punching example - connecting through firewall

Lets say I have two computers. They know each others public and private IPs via ice4j. One client listening and the other one sending some string. I'd like to see this happen via UPD hole punching: Let A be the client requesting the…
MatBanik
  • 26,356
  • 39
  • 116
  • 178
27
votes
5 answers

UDP hole punching implementation

I am trying to accomplish UDP hole punching. I am basing my theory on this article and this WIKI page, but I am facing some issues with the C# coding of it. Here is my problem: Using the code that was posted here I am now able to connect to a remote…
brooc
  • 448
  • 2
  • 6
  • 10
27
votes
5 answers

What's so hard about p2p Hole Punching?

I am trying to experiment with some p2p networking. Upon doing some research, one of the biggest obstacle I learnt is "What if a client is behind a NAT/Firewall", later on I discovered about Hole Punching but that it is not always guaranteed to…
Krimson
  • 7,386
  • 11
  • 60
  • 97
25
votes
2 answers

How to simulate different NAT behaviours

I am working on Holepunching using UDP and UDT. For the final testing I need to test the application on different NAT types (Symmetric,full cone,restricted cone, port restricted NATs). Is there any method I can simulate these? What I expect here is…
user739711
  • 1,842
  • 1
  • 25
  • 30
20
votes
2 answers

UDP Hole Punching Algorithm

Can anyone give an example of a UDP Hole Punching ? Actually, I want to write a chat program with which people can chat when they know each other's IP. But both the machines will be behind a firewalled router. So, I need to punch a hole in order to…
user1151738
19
votes
4 answers

TCP Hole Punching

I'm trying to implement TCP hole punching with windows socket using mingw toolchain. I think the process is right but the hole doesn't seems to take. I used this as reference. A and B connect to the server S S sends to A, B's router IP + the port…
Giann
  • 3,142
  • 3
  • 23
  • 33
18
votes
3 answers

UDP Hole Punching Java Example

I want to do UDP Hole Punching with two clients with the help of a server with a static IP. The server waits for the two clients on port 7070 and 7071. After that it sends the IP address and port to each other. This part is working fine. But I'm not…
Crossader
  • 316
  • 1
  • 2
  • 9
16
votes
4 answers

UDP hole punching. Have server talk to client

I been reading a lot on how to implement UDP hole punching but fore some reason I cannot make it work. For those that are not familiar of what udp hole punching is here is my own definition: The goal is to be able to transfer data between two…
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
11
votes
2 answers

How to make 2 clients connect each other directly, after having both connected a meeting-point server?

I'm writing a toy meeting-point/relay server listening on port 5555 for two clients "A" and "B". It works like this: every byte received by the server from the firstly-connected client A will be sent to the secondly-connected client B, even if A…
Basj
  • 41,386
  • 99
  • 383
  • 673
11
votes
1 answer

UDP/TCP hole punching vs UPnP vs STUN vs?

I try to make a P2P Program and need help with getting through the NAT of the clients. I have read many questions here on stackoverflow, but i never got what the drawbacks and benefits of all the Methods to get through a NAT are. How many routers…
user2422196
  • 297
  • 3
  • 13
10
votes
1 answer

How do I do TCP hole punching?

Question is below. Here is my current test code which did not succeed. static void Main(string[] args) { if (args.Count() != 3) { Console.WriteLine("Bad args"); } var ep = new IPEndPoint(IPAddress.Parse(args[0]),…
user34537
10
votes
3 answers

Communicating directly between two mobile devices

I'm mostly interested in a general answer for mobile, but something android specific would be acceptable. Given 2 mobile devices, how can I get a connection between them. I'm new to mobile development, and I'm not sure what kind of NAT mobile…
Cruncher
  • 7,641
  • 1
  • 31
  • 65
9
votes
1 answer

Problems with TCP hole punching

I've tried to write a basic TCP hole puncher for a firewall in Python 3 using the principles outlined in this article. I'm having trouble getting anything to connect, though. Here is the code: #!/usr/bin/python3 import sys import socket import…
George Hilliard
  • 15,402
  • 9
  • 58
  • 96
8
votes
1 answer

Trying get dynamic content hole-punched through Magento's Full Page Cache

I am using Magento Enterprise 1.10.1.1 and need to get some dynamic content on our product pages. I am inserting the current time in a block to quickly see if it is working, but can't seem to get through full page cache. I have tried a variety of…
rlflow
  • 265
  • 1
  • 4
  • 12
1
2 3
11 12