我是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);我尝试使用此代码,但它没有向服务器发送任何消息。有人能帮我找到正确的密码吗?这样我就可以把我的智商发送到服务器并接收响应
发布于 2014-03-10 10:17:55
还没有测试过,但是试一下
IQ iq = new IQ();
iq.setTo("destination@server");
iq.setFrom("9f30dacb@web.vlivetech.com/9f30dacb");
iq.setType(IQ.Type.GET);
iq.setPacketID("1");
connection.sendPacket(iq);发布于 2014-04-06 20:50:06
我认为您应该使用正确的目的地地址,其中包括来自目的地的资源,如下面的示例。
iq.setTo("destination@dominio_destination.com/recurso_destination");现在您可以发送数据包:
connection.sendPacket(iq);https://stackoverflow.com/questions/22296981
复制相似问题