Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

端口占用的问题.. #48

Closed
Barcelonao opened this issue Aug 9, 2018 · 5 comments
Closed

端口占用的问题.. #48

Barcelonao opened this issue Aug 9, 2018 · 5 comments

Comments

@Barcelonao
Copy link

其他的DHT节点获取我的ip和端口 是从我发送的UDP包中获取的
如果我Server端与Client 绑定的是同一端口就会有冲突
如果不是同一端口 那么在其他节点的路由表中, 我的DHT节点ip和端口是 我Client端发送的ip 和端口
那么说 我的client 端和 Server不能同时运行吗?
还是我的理解有误?

@Barcelonao
Copy link
Author

原谅我这烂语言组织能力
简单的说 我Client发送的端口 必须和 Server端监听端口 一致吗?

@shiyanhui
Copy link
Owner

没有所谓的client端, 只有server端(DHT server), 其他DHT节点获取到你的ip和端口是你的server端.

@Barcelonao
Copy link
Author

嗯嗯 应该是我的描述有误 Client和Server 应该指的是 UDP
我需要不断的向自己的好友列表和查询好友列表后返回的节点 主动发送 find_node请求
这时候发送数据包的UDP 的Client 的发送端口 应该就是 我UDP Server接收端口
那这样的话 同时间运行的话 就会出现端口占用的问题
请问 是哪一个环节我的理解出现了偏差?

@shiyanhui
Copy link
Owner

shiyanhui commented Aug 10, 2018

这时候发送数据包的UDP 的Client 的发送端口 应该就是 我UDP Server接收端口

发送UDP请求的时候不用指定client端口, 系统会自动为你分配. UDP相关知识你可能忘了, 建议复习下 :)

@Barcelonao
Copy link
Author

好的 非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants