iPhone上的TCP打孔 [英] TCP hole punching on iPhone

查看:298
本文介绍了iPhone上的TCP打孔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了一些阅读,虽然我是iPhone网络的新手,但我想知道是否有可能通过NAT连接两个iPhone的TCP打孔。我还阅读了一些有关uPnP和发夹的有用信息,但我根本不熟悉那些,所以如果有人对这是否可行有任何想法。

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.

我的目标是能够在很大范围内连接多个iPhone(所以最好切换到某种类型的GPSR)但是现在我只是使用两个iPhone和3G NAT Traversal似乎是理论上最简单和最可靠的。

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.

推荐答案

nat遍历是用于连接的通用术语两个节点直接借助于渲染服务器。节点可以是任何东西的计算机,智能手机或任何其他设备。至于3g而言它只是传输数据的媒介之一。

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 .

如果同一NAT下的对等设备使用公共IP连接,因为某些路由器不支持像cisco路由器等那样的发夹,发夹会显示图片。这可以是如果您使用私有IP而不是公共IP,我可以克服。在您的情况下我不能说任何关于发夹的事情,因为我没有关于您的网络的技术细节。

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.

用你正在使用的3g等技术细节更新你的问题。然后我才能说3g上的发钉。

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

我已经实现了udp / tcp打孔使用2g.I使用三台PC(一个渲染服务器和两个节点)来执行此操作。

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


  1. 开发一个将在一台pc上运行的渲染服务器程序。该程序应该能够交换两个iphone设备的公共ip 。

  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.

在iphone中开发一个客户端程序安装。将iphone连接到服务器,这会将iphone的公共ip暴露给server.repeat,第二个iphone的过程相同。现在服务器将公共IP /端口交换到两个iphone。
现在每个人同时开始同时发送数据包,这将在NAT中打洞。

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.

有关打孔的详细信息,请访问 http://www.brynosaurus.com/pub/net/p2pnat/

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

最好尝试使用易于开发的UDP打孔.TCP打孔有点棘手。一旦实现UDP打孔,很容易实现TCP打孔。

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.

了解STUN,ICE,NAT类型,Nat Maping

Learn about STUN,ICE,NAT type,Nat Maping

http://tools.ietf.org/html/rfc5389

http://en.wikipedia.org/wiki/Network_address_translation

这篇关于iPhone上的TCP打孔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆