如何获取 iPhone 聊天应用程序的端口号
我正在开发一个聊天应用程序。
但现在只能通过谷歌聊天,因为我只知道谷歌的端口号。
xmppClient = [[XMPPClient alloc] init];
[xmppClient addDelegate:self];
// Replace me with the proper domain and port.
// The example below is setup for a typical google talk account.
[xmppClient setDomain:@"talk.google.com"];
[xmppClient setPort:5222];
可以看到,google已经将端口号设置为5222。
同样,我想为 yahoo、windows Messenger 和 Windows 设置端口号。其他热门网站,我怎样才能获得所有这些?
(是这样的 - “XMPP 是 Google 专用的”吗??)
I am developing a chat application.
But Right now chatting is possible with only google because I know only google's port no.
xmppClient = [[XMPPClient alloc] init];
[xmppClient addDelegate:self];
// Replace me with the proper domain and port.
// The example below is setup for a typical google talk account.
[xmppClient setDomain:@"talk.google.com"];
[xmppClient setPort:5222];
You can see that, google has set 5222 as port number.
Same way I want to set port no for yahoo, windows messenger & other popular sites, How can I get all these?
(Is it something like that - "XMPP is specific for Google ones" ? ? )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Kraken 的 Openfire 属性页面 有您需要的端口和域信息。只需重复使用并尝试您的应用程序即可。
Kraken's Openfire Properties Page has the port and domain information you need. Just re-use and try with your application.
5222/tcp 是 XMPP 的默认端口,但您的实现可能有不同的端口。要找到答案,您可以对
_xmpp-client._tcp 执行 DNS SRV 查询。 YOURDOMAIN
,将YOURDOMAIN
替换为您尝试连接的域。这将返回 0+ 条记录,其中包含有关如何连接的主机名/端口组合。如果返回 0 条记录,则假设端口为 5222。例如,我要连接到 GoogleTalk 服务器,并使用帐户
[电子邮件受保护]
。我的客户端执行可以在命令行上使用 dig 模拟的查找,如下所示:优先级最低的结果是
5 0 5222 talk.l.google.com.
,这意味着您打开一个TCP 连接到端口 5222 上的talk.l.google.com
。要从代码进行 SRV 查询,请查看 这个答案,它依赖于 DNSServiceQueryRecord。
5222/tcp is the default port for XMPP, but your implementation may have a different one. To find out, you do a DNS SRV query for
_xmpp-client._tcp.YOURDOMAIN
, where you replaceYOURDOMAIN
with the domain you're trying to connect to. This will return 0+ records that have hostname/port combinations for how to connect. If you get 0 records back, assume port 5222.For example, I want to connect to the GoogleTalk server, and log in with the account
[email protected]
. My client performs the lookup that can be simulated with dig on the command line like this:The result with the lowest priority number is
5 0 5222 talk.l.google.com.
, which means you open a TCP connection totalk.l.google.com
on port 5222.To make SRV queries from code, check out this answer, which relies on DNSServiceQueryRecord.