| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> P2P zhi UDP chuan tou NAT de yuan li yu shi xian

P2P zhi UDP chuan tou NAT de yuan li yu shi xian

2006-12-17 07:41:48 编辑來源:互联网 评论
 
 
 
本文为【P2P 之 UDP穿透NAT的原理与实现】的拼音翻译版
  P2P zhi UDP chuan tou NAT de yuan li yu shi xian
  
  P2P zhi UDP chuan tou NAT de yuan li yu shi xian zhai zi DELPHI he zi http://www.2ccc.com/article.asp?articleid=2048
  P2P zhi UDP chuan tou NAT de yuan li yu shi xian
  yuan chuang :shootingstars
  shen kao :http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt
  lun tan shang jing chang you dui P2P yuan li de tao lun , dan shi tao lun gui tao lun , hen shao you shi zhi de dong xi chan sheng ( yuan dai ma )。 he he , zai zhe li wo jiu yong zi ji shi xian de yi ge yuan dai ma lai shuo ming UDP
  chuan yue NAT de yuan li 。
  shou xian xian jie shao yi xie ji ben gai nian :
   NAT(Network Address Translators), wang luo di zhi zhuan huan : wang luo di zhi zhuan huan shi zai IP di zhi ri yi que fa de qing kuang xia chan sheng de , ta de zhu yao mu de jiu shi wei le neng gou di
  zhi chong yong 。NAT fen wei liang da lei , ji ben de NAT he NAPT(Network Address/Port Translator)。
   zui kai shi NAT shi yun xing zai lu you qi shang de yi ge gong neng mo kuai 。
  
   zui xian ti chu de shi ji ben de NAT, ta de chan sheng ji yu ru xia shi shi : yi ge si you wang luo ( yu ) zhong de jie dian zhong zhi you hen shao de jie dian xu yao yu wai wang lian jie ( he he , zhe shi zai shang shi ji
  90 nian dai zhong qi ti chu de )。 na me zhe ge zi wang zhong qi shi zhi you shao shu de jie dian xu yao quan qiu wei yi de IP di zhi , qi ta de jie dian de IP di zhi ying gai shi ke yi chong yong de 。
   yin ci , ji ben de NAT shi xian de gong neng hen jian dan , zai zi wang nei shi yong yi ge bao liu de IP zi wang duan , zhe xie IP dui wai shi bu ke jian de 。 zi wang nei zhi you shao shu yi xie IP di zhi ke yi dui ying dao
  zhen zheng quan qiu wei yi de IP di zhi 。 ru guo zhe xie jie dian xu yao fang wen wai bu wang luo , na me ji ben NAT jiu fu ze jiang zhe ge jie dian de zi wang nei IP zhuan hua wei yi ge quan qiu wei yi de IP ran hou fa song chu qu 。
  ( ji ben de NAT hui gai bian IP bao zhong de yuan IP di zhi , dan shi bu hui gai bian IP bao zhong de duan kou )
   guan yu ji ben de NAT ke yi shen kan RFC 1631
  
   ling wai yi zhong NAT jiao zuo NAPT, cong ming cheng shang wo men ye ke yi kan de chu ,NAPT bu dan hui gai bian jing guo zhe ge NAT she bei de IP shu ju bao de IP di zhi , huan hui gai bian IP shu ju bao de TCP/UDP
  duan kou 。 ji ben NAT de she bei ke neng wo men jian de bu duo ( he he , wo mei you jian dao guo ),NAPT cai shi wo men zhen zheng tao lun de zhu jiao 。 kan xia tu :
   Server S1
   18.181.0.31:1235
   |
   ^ Session 1 (A-S1) ^ |
   | 18.181.0.31:1235 | |
   v 155.99.25.11:62000 v |
   |
   NAT
   155.99.25.11
   |
   ^ Session 1 (A-S1) ^ |
   | 18.181.0.31:1235 | |
   v 10.0.0.1:1234 v |
   |
   Client A
   10.0.0.1:1234
   you yi ge si you wang luo 10.*.*.*,Client A shi qi zhong de yi tai ji suan ji , zhe ge wang luo de wang guan ( yi ge NAT she bei ) de wai wang IP shi 155.99.25.11( ying gai huan you yi ge nei wang
  de IP di zhi , bi ru 10.0.0.10)。 ru guo Client A zhong de mou ge jin cheng ( zhe ge jin cheng chuang jian le yi ge UDP Socket, zhe ge Socket bang ding 1234 duan kou ) xiang fang wen wai wang zhu ji
  18.181.0.31 de 1235 duan kou , na me dang shu ju bao tong guo NAT shi hui fa sheng shen me shi qing ne ?
   shou xian NAT hui gai bian zhe ge shu ju bao de yuan IP di zhi , gai wei 155.99.25.11。 jie zhe NAT hui wei zhe ge chuan shu chuang jian yi ge Session(Session shi yi ge chou xiang de gai nian , ru guo shi
  TCP, ye xu Session shi you yi ge SYN bao kai shi , yi yi ge FIN bao jie shu 。 er UDP ne , yi zhe ge IP de zhe ge duan kou de di yi ge UDP kai shi , jie shu ne , he he , ye xu shi ji fen zhong ,
  ye xu shi ji xiao shi , zhe yao kan ju ti de shi xian le ) bing qie gei zhe ge Session fen pei yi ge duan kou , bi ru 62000, ran hou gai bian zhe ge shu ju bao de yuan duan kou wei 62000。 suo yi ben lai shi
  (10.0.0.1:1234->18.181.0.31:1235) de shu ju bao dao le hu lian wang shang bian wei le (155.99.25.11:62000->18.181.0.31:1235)。
   yi dan NAT chuang jian le yi ge Session hou ,NAT hui ji zhu 62000 duan kou dui ying de shi 10.0.0.1 de 1234 duan kou , yi hou cong 18.181.0.31 fa song dao 62000 duan kou de shu ju hui bei NAT zi
  dong de zhuan fa dao 10.0.0.1 shang 。( zhu yi : zhe li shi shuo 18.181.0.31 fa song dao 62000 duan kou de shu ju hui bei zhuan fa , qi ta de IP fa song dao zhe ge duan kou de shu ju jiang bei NAT pao qi ) zhe yang
  Client A jiu yu Server S1 jian li yi le yi ge lian jie 。
   he he , shang mian de ji chu zhi shi ke neng hen duo ren dou zhi dao le , na me xia mian shi guan jian de bu fen le 。
   kan kan xia mian de qing kuang :
   Server S1 Server S2
  18.181.0.31:1235 138.76.29.7:1235
   | |
   | |
   +----------+----------+
   |
   ^ Session 1 (A-S1) ^ | ^ Session 2 (A-S2) ^
   | 18.181.0.31:1235 | | | 138.76.29.7:1235 |
   v 155.99.25.11:62000 v | v 155.99.25.11:62000 v
   |
   Cone NAT
   155.99.25.11
   |
   ^ Session 1 (A-S1) ^ | ^ Session 2 (A-S2) ^
   | 18.181.0.31:1235 | | | 138.76.29.7:1235 |
   v 10.0.0.1:1234 v | v 10.0.0.1:1234 v
   |
   Client A
   10.0.0.1:1234
   jie shang mian de li zi , ru guo Client A de yuan lai na ge Socket( bang ding le 1234 duan kou de na ge UDP Socket) you jie zhe xiang ling wai yi ge Server S2 fa song le yi ge UDP bao , na me
  zhe ge UDP bao zai tong guo NAT shi hui zen me yang ne ?
   zhe shi ke neng hui you liang zhong qing kuang fa sheng , yi zhong shi NAT zai ci chuang jian yi ge Session, bing qie zai ci wei zhe ge Session fen pei yi ge duan kou hao ( bi ru :62001)。 ling wai yi zhong shi NAT
  zai ci chuang jian yi ge Session, dan shi bu hui xin fen pei yi ge duan kou hao , er shi yong yuan lai fen pei de duan kou hao 62000。 qian yi zhong NAT jiao zuo Symmetric NAT, hou yi zhong jiao zuo Cone NAT。
  wo men qi wang wo men de NAT shi di er zhong , he he , ru guo ni de NAT gang hao shi di yi zhong , na me hen ke neng hui you hen duo P2P ruan jian shi ling 。( ke yi qing xing de shi , xian zai jue da duo shu de NAT shu
  yu hou zhe , ji Cone NAT)
  
   hao le , wo men kan dao , tong guo NAT, zi wang nei de ji suan ji xiang wai lian jie shi hen rong yi de (NAT xiang dang yu tou ming de , zi wang nei de he wai wang de ji suan ji bu yong zhi dao NAT de qing kuang )。
   dan shi ru guo wai bu de ji suan ji xiang fang wen zi wang nei de ji suan ji jiu bi jiao kun nan le ( er zhe zheng shi P2P suo xu yao de )。
   na me wo men ru guo xiang cong wai bu fa song yi ge shu ju bao gei nei wang de ji suan ji you shen me ban fa ne ? shou xian , wo men bi xu zai nei wang de NAT shang da shang yi ge “ dong ”( ye jiu shi qian mian wo men shuo
  de zai NAT shang jian li yi ge Session), zhe ge dong bu neng you wai bu lai da , zhi neng you nei wang nei de zhu ji lai da 。 er qie zhe ge dong shi you fang xiang de , bi ru cong nei bu mou tai zhu ji ( bi ru :
  192.168.0.10) xiang wai bu de mou ge IP( bi ru :219.237.60.1) fa song yi ge UDP bao , na me jiu zai zhe ge nei wang de NAT she bei shang da le yi ge fang xiang wei 219.237.60.1 de “ dong ”
  ,( zhe jiu shi cheng wei UDP Hole Punching de ji shu ) yi hou 219.237.60.1 jiu ke yi tong guo zhe ge dong yu nei wang de 192.168.0.10 lian xi le 。( dan shi qi ta de IP bu neng li yong zhe ge
  dong )。
  
   he he , xian zai gai lun dao wo men de zheng ti P2P le 。 you le shang mian de li lun , shi xian liang ge nei wang de zhu ji tong xun jiu cha zui hou yi bu le : na jiu shi ji sheng dan huan shi dan sheng ji de wen ti le , liang
  bian dou wu fa zhu dong fa chu lian jie qing qiu , shui ye bu zhi dao shui de gong wang di zhi , na wo men ru he lai da zhe ge dong ne ? wo men xu yao yi ge zhong jian ren lai lian xi zhe liang ge nei wang zhu ji 。
   xian zai wo men lai kan kan yi ge P2P ruan jian de liu cheng , yi xia tu wei li :
   Server S (219.237.60.1)
   |
   |
   +----------+----------+
   | |
  NAT A ( wai wang IP:202.187.45.3) NAT B ( wai wang IP:187.34.1.56)
   | ( nei wang IP:192.168.0.1) | ( nei wang IP:192.168.0.1)
   | |
  Client A (192.168.0.20:4000) Client B (192.168.0.10:40000)
   shou xian ,Client A deng lu fu wu qi ,NAT A wei zhe ci de Session fen pei le yi ge duan kou 60000, na me Server S shou dao de Client A de di zhi shi 202.187.45.3:60000,
  zhe jiu shi Client A de wai wang di zhi le 。 tong yang ,Client B deng lu Server S,NAT B gei ci ci Session fen pei de duan kou shi 40000, na me Server S shou dao de B de di zhi shi
  187.34.1.56:40000。
   ci shi ,Client A yu Client B dou ke yi yu Server S tong xin le 。 ru guo Client A ci shi xiang zhi jie fa song xin xi gei Client B, na me ta ke yi cong Server S na er huo de B de
  gong wang di zhi 187.34.1.56:40000, shi bu shi Client A xiang zhe ge di zhi fa song xin xi Client B jiu neng shou dao le ne ? da an shi bu xing , yin wei ru guo zhe yang fa song xin xi ,NAT B hui jiang
  zhe ge xin xi diu qi ( yin wei zhe yang de xin xi shi bu qing zi lai de , wei le an quan , da duo shu NAT dou hui zhi xing diu qi dong zuo )。 xian zai wo men xu yao de shi zai NAT B shang da yi ge fang xiang wei
  202.187.45.3( ji Client A de wai wang di zhi ) de dong , na me Client A fa song dao 187.34.1.56:40000 de xin xi ,Client B jiu neng shou dao le 。 zhe ge da dong ming ling you shui lai fa
  ne , he he , dang ran shi Server S。
   zong jie yi xia zhe ge guo cheng : ru guo Client A xiang xiang Client B fa song xin xi , na me Client A fa song ming ling gei Server S, qing qiu Server S ming ling Client B xiang Client A fang
  xiang da dong 。 he he , shi bu shi hen rao kou , bu guo mei guan xi , xiang yi xiang jiu hen qing chu le , he kuang huan you yuan dai ma ne ( hou lao shi shuo guo : zai yuan dai ma mian qian mei you mi mi 8)), ran hou
  Client A jiu ke yi tong guo Client B de wai wang di zhi yu Client B tong xin le 。
  
   zhu yi : yi shang guo cheng zhi shi he yu Cone NAT de qing kuang , ru guo shi Symmetric NAT, na me dang Client B xiang Client A da dong de duan kou yi jing chong xin fen pei le ,Client B jiang wu
  fa zhi dao zhe ge duan kou ( ru guo Symmetric NAT de duan kou shi shun xu fen pei de , na me wo men huo xu ke yi cai ce zhe ge duan kou hao , ke shi you yu ke neng dao zhi shi bai de yin su tai duo , wo men bu tui
  jian zhe zhong cai ce duan kou de fang fa )。
  
   xia mian shi yi ge mo ni P2P liao tian de guo cheng de yuan dai ma , guo cheng hen jian dan ,P2PServer yun xing zai yi ge yong you gong wang IP de ji suan ji shang ,P2PClient yun xing zai liang ge bu tong de NAT hou
  ( zhu yi , ru guo liang ge ke hu duan yun xing zai yi ge NAT hou , ben cheng xu hen ke neng bu neng yun xing zheng chang , zhe qu jue yu ni de NAT shi fou zhi chi loopback translation, xiang jian
  http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt, dang ran , ci wen ti ke yi tong guo shuang fang xian chang shi lian jie dui fang de nei wang IP lai jie jue , dan shi zhe
  ge dai ma zhi shi wei le yan zheng yuan li , bing mei you chu li zhe xie wen ti ), hou deng lu de ji suan ji ke yi huo de xian deng lu ji suan ji de yong hu ming , hou deng lu de ji suan ji tong guo send username
  message de ge shi lai fa song xiao xi 。 ru guo fa song cheng gong , shuo ming ni yi qu de le zhi jie yu dui fang lian jie de cheng gong 。【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
P2P zhi UDP chuan tou NAT de yuan li yu shi xian P2P zhi UDP chuan tou NAT de yuan li yu shi xian zhai zi DELPHI he zi http://www.2ccc.com/article.asp?articleid=2048 P2P zhi UDP chuan tou NAT de yuan li yu shi xian yuan chuang :shootingstars shen kao :http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt lun tan shang jing chang you dui P2P yuan li de tao lun , dan shi tao lun gui tao lun , hen shao you shi zhi de dong xi chan sheng ( yuan dai ma )。 he he , zai zhe li wo jiu yong zi ji shi xian de yi ge yuan dai ma lai shuo ming UDP chuan yue NAT de yuan li 。 shou xian xian jie shao yi xie ji ben gai nian : NAT(Network Address Translators), wang luo di zhi zhuan huan : wang luo di zhi zhuan huan shi zai IP di zhi ri yi que fa de qing kuang xia chan sheng de , ta de zhu yao mu de jiu shi wei le neng gou di zhi chong yong 。NAT fen wei liang da lei , ji ben de NAT he NAPT(Network Address/Port Translator)。 zui kai shi NAT shi yun xing zai lu you qi shang de yi ge gong neng mo kuai 。 zui xian ti chu de shi ji ben de NAT, ta de chan sheng ji yu ru xia shi shi : yi ge si you wang luo ( yu ) zhong de jie dian zhong zhi you hen shao de jie dian xu yao yu wai wang lian jie ( he he , zhe shi zai shang shi ji 90 nian dai zhong qi ti chu de )。 na me zhe ge zi wang zhong qi shi zhi you shao shu de jie dian xu yao quan qiu wei yi de IP di zhi , qi ta de jie dian de IP di zhi ying gai shi ke yi chong yong de 。 yin ci , ji ben de NAT shi xian de gong neng hen jian dan , zai zi wang nei shi yong yi ge bao liu de IP zi wang duan , zhe xie IP dui wai shi bu ke jian de 。 zi wang nei zhi you shao shu yi xie IP di zhi ke yi dui ying dao zhen zheng quan qiu wei yi de IP di zhi 。 ru guo zhe xie jie dian xu yao fang wen wai bu wang luo , na me ji ben NAT jiu fu ze jiang zhe ge jie dian de zi wang nei IP zhuan hua wei yi ge quan qiu wei yi de IP ran hou fa song chu qu 。 ( ji ben de NAT hui gai bian IP bao zhong de yuan IP di zhi , dan shi bu hui gai bian IP bao zhong de duan kou ) guan yu ji ben de NAT ke yi shen kan RFC 1631 ling wai yi zhong NAT jiao zuo NAPT, cong ming cheng shang wo men ye ke yi kan de chu ,NAPT bu dan hui gai bian jing guo zhe ge NAT she bei de IP shu ju bao de IP di zhi , huan hui gai bian IP shu ju bao de TCP/UDP duan kou 。 ji ben NAT de she bei ke neng wo men jian de bu duo ( he he , wo mei you jian dao guo ),NAPT cai shi wo men zhen zheng tao lun de zhu jiao 。 kan xia tu : Server S1 18.181.0.31:1235 | ^ Session 1 (A-S1) ^ | | 18.181.0.31:1235 | | v 155.99.25.11:62000 v | | NAT 155.99.25.11 | ^ Session 1 (A-S1) ^ | | 18.181.0.31:1235 | | v 10.0.0.1:1234 v | | Client A 10.0.0.1:1234 you yi ge si you wang luo 10.*.*.*,Client A shi qi zhong de yi tai ji suan ji , zhe ge wang luo de wang guan ( yi ge NAT she bei ) de wai wang IP shi 155.99.25.11( ying gai huan you yi ge nei wang de IP di zhi , bi ru 10.0.0.10)。 ru guo Client A zhong de mou ge jin cheng ( zhe ge jin cheng chuang jian le yi ge UDP Socket, zhe ge Socket bang ding 1234 duan kou ) xiang fang wen wai wang zhu ji 18.181.0.31 de 1235 duan kou , na me dang shu ju bao tong guo NAT shi hui fa sheng shen me shi qing ne ? shou xian NAT hui gai bian zhe ge shu ju bao de yuan IP di zhi , gai wei 155.99.25.11。 jie zhe NAT hui wei zhe ge chuan shu chuang jian yi ge Session(Session shi yi ge chou xiang de gai nian , ru guo shi TCP, ye xu Session shi you yi ge SYN bao kai shi , yi yi ge FIN bao jie shu 。 er UDP ne , yi zhe ge IP de zhe ge duan kou de di yi ge UDP kai shi , jie shu ne , he he , ye xu shi ji fen zhong , ye xu shi ji xiao shi , zhe yao kan ju ti de shi xian le ) bing qie gei zhe ge Session fen pei yi ge duan kou , bi ru 62000, ran hou gai bian zhe ge shu ju bao de yuan duan kou wei 62000。 suo yi ben lai shi (10.0.0.1:1234->18.181.0.31:1235) de shu ju bao dao le hu lian wang shang bian wei le (155.99.25.11:62000->18.181.0.31:1235)。 yi dan NAT chuang jian le yi ge Session hou ,NAT hui ji zhu 62000 duan kou dui ying de shi 10.0.0.1 de 1234 duan kou , yi hou cong 18.181.0.31 fa song dao 62000 duan kou de shu ju hui bei NAT zi dong de zhuan fa dao 10.0.0.1 shang 。( zhu yi : zhe li shi shuo 18.181.0.31 fa song dao 62000 duan kou de shu ju hui bei zhuan fa , qi ta de IP fa song dao zhe ge duan kou de shu ju jiang bei NAT pao qi ) zhe yang Client A jiu yu Server S1 jian li yi le yi ge lian jie 。 he he , shang mian de ji chu zhi shi ke neng hen duo ren dou zhi dao le , na me xia mian shi guan jian de bu fen le 。 kan kan xia mian de qing kuang : Server S1 Server S2 18.181.0.31:1235 138.76.29.7:1235 | | | | +----------+----------+ | ^ Session 1 (A-S1) ^ | ^ Session 2 (A-S2) ^ | 18.181.0.31:1235 | | | 138.76.29.7:1235 | v 155.99.25.11:62000 v | v 155.99.25.11:62000 v | Cone NAT 155.99.25.11 | ^ Session 1 (A-S1) ^ | ^ Session 2 (A-S2) ^ | 18.181.0.31:1235 | | | 138.76.29.7:1235 | v 10.0.0.1:1234 v | v 10.0.0.1:1234 v | Client A 10.0.0.1:1234 jie shang mian de li zi , ru guo Client A de yuan lai na ge Socket( bang ding le 1234 duan kou de na ge UDP Socket) you jie zhe xiang ling wai yi ge Server S2 fa song le yi ge UDP bao , na me zhe ge UDP bao zai tong guo NAT shi hui zen me yang ne ? zhe shi ke neng hui you liang zhong qing kuang fa sheng , yi zhong shi NAT zai ci chuang jian yi ge Session, bing qie zai ci wei zhe ge Session fen pei yi ge duan kou hao ( bi ru :62001)。 ling wai yi zhong shi NAT zai ci chuang jian yi ge Session, dan shi bu hui xin fen pei yi ge duan kou hao , er shi yong yuan lai fen pei de duan kou hao 62000。 qian yi zhong NAT jiao zuo Symmetric NAT, hou yi zhong jiao zuo Cone NAT。 wo men qi wang wo men de NAT shi di er zhong , he he , ru guo ni de NAT gang hao shi di yi zhong , na me hen ke neng hui you hen duo P2P ruan jian shi ling 。( ke yi qing xing de shi , xian zai jue da duo shu de NAT shu yu hou zhe , ji Cone NAT) hao le , wo men kan dao , tong guo NAT, zi wang nei de ji suan ji xiang wai lian jie shi hen rong yi de (NAT xiang dang yu tou ming de , zi wang nei de he wai wang de ji suan ji bu yong zhi dao NAT de qing kuang )。 dan shi ru guo wai bu de ji suan ji xiang fang wen zi wang nei de ji suan ji jiu bi jiao kun nan le ( er zhe zheng shi P2P suo xu yao de )。 na me wo men ru guo xiang cong wai bu fa song yi ge shu ju bao gei nei wang de ji suan ji you shen me ban fa ne ? shou xian , wo men bi xu zai nei wang de NAT shang da shang yi ge “ dong ”( ye jiu shi qian mian wo men shuo de zai NAT shang jian li yi ge Session), zhe ge dong bu neng you wai bu lai da , zhi neng you nei wang nei de zhu ji lai da 。 er qie zhe ge dong shi you fang xiang de , bi ru cong nei bu mou tai zhu ji ( bi ru : 192.168.0.10) xiang wai bu de mou ge IP( bi ru :219.237.60.1) fa song yi ge UDP bao , na me jiu zai zhe ge nei wang de NAT she bei shang da le yi ge fang xiang wei 219.237.60.1 de “ dong ” ,( zhe jiu shi cheng wei UDP Hole Punching de ji shu ) yi hou 219.237.60.1 jiu ke yi tong guo zhe ge dong yu nei wang de 192.168.0.10 lian xi le 。( dan shi qi ta de IP bu neng li yong zhe ge dong )。 he he , xian zai gai lun dao wo men de zheng ti P2P le 。 you le shang mian de li lun , shi xian liang ge nei wang de zhu ji tong xun jiu cha zui hou yi bu le : na jiu shi ji sheng dan huan shi dan sheng ji de wen ti le , liang bian dou wu fa zhu dong fa chu lian jie qing qiu , shui ye bu zhi dao shui de gong wang di zhi , na wo men ru he lai da zhe ge dong ne ? wo men xu yao yi ge zhong jian ren lai lian xi zhe liang ge nei wang zhu ji 。 xian zai wo men lai kan kan yi ge P2P ruan jian de liu cheng , yi xia tu wei li : Server S (219.237.60.1) | | +----------+----------+ | | NAT A ( wai wang IP:202.187.45.3) NAT B ( wai wang IP:187.34.1.56) | ( nei wang IP:192.168.0.1) | ( nei wang IP:192.168.0.1) | | Client A (192.168.0.20:4000) Client B (192.168.0.10:40000) shou xian ,Client A deng lu fu wu qi ,NAT A wei zhe ci de Session fen pei le yi ge duan kou 60000, na me Server S shou dao de Client A de di zhi shi 202.187.45.3:60000, zhe jiu shi Client A de wai wang di zhi le 。 tong yang ,Client B deng lu Server S,NAT B gei ci ci Session fen pei de duan kou shi 40000, na me Server S shou dao de B de di zhi shi 187.34.1.56:40000。 ci shi ,Client A yu Client B dou ke yi yu Server S tong xin le 。 ru guo Client A ci shi xiang zhi jie fa song xin xi gei Client B, na me ta ke yi cong Server S na er huo de B de gong wang di zhi 187.34.1.56:40000, shi bu shi Client A xiang zhe ge di zhi fa song xin xi Client B jiu neng shou dao le ne ? da an shi bu xing , yin wei ru guo zhe yang fa song xin xi ,NAT B hui jiang zhe ge xin xi diu qi ( yin wei zhe yang de xin xi shi bu qing zi lai de , wei le an quan , da duo shu NAT dou hui zhi xing diu qi dong zuo )。 xian zai wo men xu yao de shi zai NAT B shang da yi ge fang xiang wei 202.187.45.3( ji Client A de wai wang di zhi ) de dong , na me Client A fa song dao 187.34.1.56:40000 de xin xi ,Client B jiu neng shou dao le 。 zhe ge da dong ming ling you shui lai fa ne , he he , dang ran shi Server S。 zong jie yi xia zhe ge guo cheng : ru guo Client A xiang xiang Client B fa song xin xi , na me Client A fa song ming ling gei Server S, qing qiu Server S ming ling Client B xiang Client A fang xiang da dong 。 he he , shi bu shi hen rao kou , bu guo mei guan xi , xiang yi xiang jiu hen qing chu le , he kuang huan you yuan dai ma ne ( hou lao shi shuo guo : zai yuan dai ma mian qian mei you mi mi 8)), ran hou Client A jiu ke yi tong guo Client B de wai wang di zhi yu Client B tong xin le 。 zhu yi : yi shang guo cheng zhi shi he yu Cone NAT de qing kuang , ru guo shi Symmetric NAT, na me dang Client B xiang Client A da dong de duan kou yi jing chong xin fen pei le ,Client B jiang wu fa zhi dao zhe ge duan kou ( ru guo Symmetric NAT de duan kou shi shun xu fen pei de , na me wo men huo xu ke yi cai ce zhe ge duan kou hao , ke shi you yu ke neng dao zhi shi bai de yin su tai duo , wo men bu tui jian zhe zhong cai ce duan kou de fang fa )。 xia mian shi yi ge mo ni P2P liao tian de guo cheng de yuan dai ma , guo cheng hen jian dan ,P2PServer yun xing zai yi ge yong you gong wang IP de ji suan ji shang ,P2PClient yun xing zai liang ge bu tong de NAT hou ( zhu yi , ru guo liang ge ke hu duan yun xing zai yi ge NAT hou , ben cheng xu hen ke neng bu neng yun xing zheng chang , zhe qu jue yu ni de NAT shi fou zhi chi loopback translation, xiang jian http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt, dang ran , ci wen ti ke yi tong guo shuang fang xian chang shi lian jie dui fang de nei wang IP lai jie jue , dan shi zhe ge dai ma zhi shi wei le yan zheng yuan li , bing mei you chu li zhe xie wen ti ), hou deng lu de ji suan ji ke yi huo de xian deng lu ji suan ji de yong hu ming , hou deng lu de ji suan ji tong guo send username message de ge shi lai fa song xiao xi 。 ru guo fa song cheng gong , shuo ming ni yi qu de le zhi jie yu dui fang lian jie de cheng gong 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
赏心悦目的模特儿(9)
赏心悦目的模特儿(8)
赏心悦目的模特儿(7)
赏心悦目的模特儿(6)
周六一日游--绿野翠蜂场(一)
骆驼峰
下一站上环
杂乱的几张Danang
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有