Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCP hole punching on iPhone

I have done a bit of reading, and although I'm new to iPhone networking I was wondering if a TCP hole punch is possible for connecting two iPhones through NAT. I also read some helpful things about uPnP and hairpinning but I'm not to familiar with those at all, so if anyone has any ideas as to whether or not this is possible.

My goal is to be able to connect multiple iPhones over a large range (so it may be better to switch to some type of GPSR) but for now I'm only working with two iPhones and 3G NAT Traversal seems the simplest and most reliable in theory.

like image 742
Skyler Avatar asked Jun 21 '11 07:06

Skyler


1 Answers

nat traversal is generic term used to connect two node directly with the help of rendevous server.Node can be any thing computer, smart phone or any other device.as far 3g is concerned it is one of the medium to transfer data nothing more .

Hair pin comes in to picture if your peer devices under same NAT uses public ip to connect each other because some router does not support hairpining like cisco router etc.This can be overcome if you use private IP instead of public IP.I can't say any thing about hair pinning in your case, since i don't the technical details about your network.

Update your question with technical details like kind of 3g you are using.then only I can say about hair pinning on 3g.

I have implemented udp/tcp hole punching using on 2g.I used three PC(one rendevous server and two node) to do this.

  1. develop a rendevous server program which will run on one pc.the program should be capable to exchange public ip of two iphone device.

  2. develop a client program install in iphone.Connect iphone to server this will expose public ip of iphone to server.repeat same process for second iphone. Now server will exchange public ip/port to both iphone. now each simultaneously start sending packet to each other at the same time this will punch hole in NAT.

detail about hole punching can be found on this http://www.brynosaurus.com/pub/net/p2pnat/

Better try with UDP hole punchcing which is easy to develop.TCP hole punching is bit tricky.Once you implement UDP Hole punching it is easy to to implement TCP hole punching.

Learn about STUN,ICE,NAT type,Nat Maping

https://www.rfc-editor.org/rfc/rfc5389
http://en.wikipedia.org/wiki/Network_address_translation

like image 132
Vikram Ranabhatt Avatar answered Sep 19 '22 07:09

Vikram Ranabhatt