【发布时间】:2012-02-12 03:48:09
【问题描述】:
我正在使用 XMPP 服务器制作聊天应用程序。聊天应用程序运行良好,但我有一个问题:在 2 个用户之间聊天时,我不知道来自第一个用户的消息是否已到达服务器。
那么如何知道来自第一个用户的消息是否到达服务器,而不必担心第二个用户是在线还是离线。
请帮忙
我正在发送这样的消息:
final SecureConnection sc = (SecureConnection)Connector.open("ssl://...", Connector.READ_WRITE);
is = sc.openInputStream();
os = sc.openOutputStream();
this.reader = new XmlReader(is);
this.writer = new XmlWriter(os);
public boolean sendMessage(final String to, final String msg) {
this.writer.startTag("message");
this.writer.attribute("type", "chat");
this.writer.attribute("to", to);
this.writer.startTag("body");
this.writer.text(msg);
this.writer.endTag();
this.writer.endTag();
this.writer.flush();
}
【问题讨论】:
-
这种方法中的作家是什么?
-
将数据写入XMPP服务器的xml writer
-
我当然知道,我想知道的是,它是哪个类的对象/变量?
-
okies,你可以使用 , HttpConnection 。或者只是检查您的 SecureConnection 是否有类似 getResponseCode() 的方法?
标签: blackberry java-me xmpp