android端口号选择上的持久TCP连接?
如果你要在 android 上实现持久的 tcp 连接,你会选择什么端口号?
这是 Google 的 C2DM 服务使用的连接类型。
If you were to implement a persistent tcp connection on android what port number would you choose?
This is the sort of connection used by Google's C2DM service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
真正使用任何端口。只要它高于 1024,它可能并不重要。假设您选择端口 5000。
我建议使用第二个 IP 地址并将 ip2:80 上的所有流量转发到 ip1:5000。这样您就可以绕过网络上的任何防火墙限制。
如果您想了解有关添加第二个 IP 地址以及向 iptables 添加 NAT 以将流量从 ip2 上的端口 80 转发到 ip1 上的端口 5000 的更多详细信息,我可以与您分享我的笔记。
Use any port really. It probably doesn't really matter so long as it's above 1024. Let's say you choose port 5000.
I'd recommend using a second ip address and forward all traffic on ip2:80 to ip1:5000. That way you can get around any firewall restrictions on your network.
If you want more details about adding a second ip address and adding a NAT to your iptables to forward traffic from port 80 on ip2 to port 5000 on ip1, I can share my notes with you.
1764年怎么样? (42*42)。或者可能是3141?
How about 1764? (42*42). Or possibly 3141?
从技术上讲,您选择哪个端口并不重要。如果您还想运行另一个服务所需的端口,则不能使用该服务。所以如果你想在邮件服务器上运行它,端口25是一个糟糕的选择。
但由于有时存在可能会过滤流量的防火墙,因此我建议使用端口 443 (https),这样流量通过的机会稍高一些。
Technically it really doesn't matter what port you choose. You just can't use a port that is needed for another service if you also want to run this service. So if you want to run it on a mail server, port 25 is a bad choice.
But since there are sometimes firewalls in place that may filter traffic, I'd recommend port 443 (https) where you have a slightly higher chance of getting your traffic through.