讨论Udp的工作原理(怎样实现OICQ聊天的程序)(300分)

  • 主题发起人 主题发起人 wjh_wy
  • 开始时间 开始时间
具体怎样做呢。
 
具体怎样做呀。
 
我一直想不明用ADSL上网的电脑的IP去那里,
因为我的ADSL有自带路由功能,每台电脑设置192.168.1.X
要实现广域网的聊天程序,好难好难啊.
 
delphi 自带的例子。netchar 可以实现!
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2217851
 
如果你有公网IP的专用服务器,还用socks做什么啊?不同局域网在你服务器中转的情况下通讯是很简单的事情!自己写个中转服务程序就行了!
 
QQ 是用服务器的哦。。。。
 
很多socks服务器不支持UDP
 
怎样实现UDP代理功能,或者谁有UDP通讯的例子(完全用Winsock完成的,不要用第三方控件)。
 
to:宁柯
能否给我一份?
songyuehua@163.net
谢谢!
 
大家讨论一下好吗。
 
NAT是什么怎样编程实现。
 
Symmetric NAT
A symmetric NAT, in contrast, does not maintain a consistent
port binding between (private IP, private port) and (public IP,
public port) across all sessions. Instead, it assigns a new
public port to each new session. For example, suppose Client A
initiates two outgoing sessions from the same port as above, one
with S1 and one with S2. A symmetric NAT might allocate the
public endpoint 155.99.25.11:62000 to session 1, and then allocate
a different public endpoint 155.99.25.11:62001, when the
application initiates session 2. The NAT is able to differentiate
between the two sessions for translation purposes because the
external endpoints involved in the sessions (those of S1
and S2) differ, even as the endpoint identity of the client
application is lost across the address translation boundary.



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:62001 v
|
Symmetric 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

The issue of cone versus symmetric NAT behavior applies equally
to TCP and UDP traffic.

Cone NAT is further classified according to how liberally the NAT
accepts incoming traffic directed to an already-established (public
IP, public port) pair. This classification generally applies only to
UDP traffic, since NATs and firewalls reject incoming TCP
connection attempts unconditionally unless specifically configured to
do otherwise.

Full Cone NAT
After establishing a public/private port binding for a new
outgoing session, a full cone NAT will subsequently accept
incoming traffic to the corresponding public port from ANY
external endpoint on the public network. Full cone NAT is
also sometimes called "promiscuous" NAT.

Restricted Cone NAT
A restricted cone NAT only forwards an incoming packet directed to
a public port if its external (source) IP address matches the
address of a node to which the internal host has previously sent
one or more outgoing packets. A restricted cone NAT effectively
refines the firewall principle of rejecting unsolicited incoming
traffic, by restricting incoming traffic to a set of "known"
external IP addresses.

Port-Restricted Cone NAT
A port-restricted cone NAT, in turn, only forwards an incoming
packet if its external IP address AND port number match those of
an external endpoint to which the internal host has previously
sent outgoing packets. A port-restricted cone NAT provides
internal nodes the same level of protection against unsolicited
incoming traffic that a symmetric NAT does, while maintaining a
private port's identity across translation.

//能否把大概的意思帮我翻译一下。
文章出自于: http://cnscenter.future.co.kr/resource/ietf/ind-draft/draft-ford-midcom-p2p-00.txt
 
我完成了socket5代理且是在公网上的的,但是我现在想用socket4或http的,不知道有没有谁能解决
 
to chengl
Socks5兼容Socks4,Socks4没有身份验证,而Socks5增加了身份验证。
能否把你的代码贴出来大家共享呢。Http代理希望有解决把代码贴出来大家共享。
 
socks代理已经解决,可以连进来或连出去,Http代理可以用Http tunnel,不过好象不支持UDP,TCP连出去没问题,连进来还没搞清楚,不知道可不可以实现
 
to:宁柯
能否给我一份?
LYJGS.168@163.com
谢谢!
 
to chengl
你说的完成了SOCKS5代理指的是TCP还是UDP?
to 乡村月光
你说socks代理已经解决,可以连进来或连出去,你又是TCP还是UDP?

qq:7310159
mail:yangying_2000@163.com

SOCKS代理有几个版本,到SOCKS5才出现UDP ASSOCIATE的标准,我看不太明白
另外,对于两个UDP的程序如果都在内网,想通过外网通讯的话,有两种方式
一是NAT(网络地址转换,NET ADDRESS TRANSLATE),这是所有网吧所用的方式,象SYGATE就是软网关,可完成NAT的功能.
二是代理,就是刚刚说的SOCKS,UDP的代理到了SOCKS5才支持的,这样的通讯需要客户端的支持,我一直没做出来,SYNAPSE的UDP类号称支持UDP ASSOCIATE,但是我测试过,只能单向通讯,总之不是QQ的那种SOCKS5代理
 
请大家不要再叫宁柯发源代码好吗,他的源码在这里:
http://www.eFile.com.cn/eFile/jxcjsh/Demos/Chat.rar
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部