如何获取 iPhone 聊天应用程序的端口号

发布于 2024-08-12 05:26:47 字数 485 浏览 4 评论 0原文

我正在开发一个聊天应用程序。

但现在只能通过谷歌聊天,因为我只知道谷歌的端口号。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

空城旧梦 2024-08-19 05:26:47

Kraken 的 Openfire 属性页面 有您需要的端口和域信息。只需重复使用并尝试您的应用程序即可。

Kraken's Openfire Properties Page has the port and domain information you need. Just re-use and try with your application.

送你一个梦 2024-08-19 05:26:47

5222/tcp 是 XMPP 的默认端口,但您的实现可能有不同的端口。要找到答案,您可以对 _xmpp-client._tcp 执行 DNS SRV 查询。 YOURDOMAIN,将 YOURDOMAIN 替换为您尝试连接的域。这将返回 0+ 条记录,其中包含有关如何连接的主机名/端口组合。如果返回 0 条记录,则假设端口为 5222。

例如,我要连接到 GoogleTalk 服务器,并使用帐户 [电子邮件受保护]。我的客户端执行可以在命令行上使用 dig 模拟的查找,如下所示:

% dig +short -t SRV _xmpp-client._tcp.gmail.com.
20 0 5222 talk1.l.google.com.
20 0 5222 talk4.l.google.com.
5 0 5222 talk.l.google.com.
20 0 5222 talk3.l.google.com.
20 0 5222 talk2.l.google.com.

优先级最低的结果是 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 replace YOURDOMAIN 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:

% dig +short -t SRV _xmpp-client._tcp.gmail.com.
20 0 5222 talk1.l.google.com.
20 0 5222 talk4.l.google.com.
5 0 5222 talk.l.google.com.
20 0 5222 talk3.l.google.com.
20 0 5222 talk2.l.google.com.

The result with the lowest priority number is 5 0 5222 talk.l.google.com., which means you open a TCP connection to talk.l.google.com on port 5222.

To make SRV queries from code, check out this answer, which relies on DNSServiceQueryRecord.

醉生梦死 2024-08-19 05:26:47

5222 是 XMPP 的默认端口,但是
你的实现可能有一个
不同的一个。为了找出答案,你做了一个
DNS 服务器查询
_xmpp-client._tcp.DOMAIN_Name,将 DOMAIN_Name 替换为
您尝试连接的域(例如
gmail.com、google.com、yahoo.com)。这
将返回 0+ 条记录
主机名/端口组合了解如何
连接。如果您返回 0 条记录,
假设端口为 5222。

5222 is the default port for XMPP, but
your implementation may have a
different one. To find out, you do a
DNS server query for
_xmpp-client._tcp.DOMAIN_Name, where you replace DOMAIN_Name with the
domain you're trying to connect to(ex.
gmail.com,google.com,yahoo.com). This
will return 0+ records that have
hostName/port combinations for how to
connect. If you get 0 records back,
assume port 5222.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文