【发布时间】:2014-03-10 09:59:14
【问题描述】:
我是 XMPP 协议的新手,我试图在 XMPP ANDROID 中找到发送和接收 IQ 数据包的好例子,但我失败了,我尝试使用以下代码块但没有帮助。
代码:
final IQ iq = new IQ() {
public String getChildElementXML() {
return "<iq type='get' from='9f30dacb@web.vlivetech.com/9f30dacb' id='1'> <query xmlns='http://jabber.org/protocol/disco#info'/></iq>"; // here is your query
//"<iq type='get' from='9f30dacb@web.vlivetech.com/9f30dacb' id='1'> <query xmlns='http://jabber.org/protocol/disco#info'/></iq>";
}};
// set the type
iq.setType(IQ.Type.GET);
// send the request
connection.sendPacket(iq);
我尝试使用此代码,但它没有向服务器发送任何消息。有人可以帮我写一段正确的代码吗?这样我就可以将我的 IQ 发送到服务器并接收响应
【问题讨论】: