第一次用openfire 服务器,用smack 发送消息
来源:互联网 发布:java虚拟机内存设置 编辑:程序博客网 时间:2024/05/17 01:12
public class SendMessage{
private XMPPConnection con;
private ChatManager chatmanager;
public XMPPConnection login(String messageProducer, String messageProducerPassword) {
ConnectionConfiguration config = new ConnectionConfiguration(this.serverDomain,
this.serverPort);
XMPPConnection con = new XMPPConnection(config);
try {
con.connect();
} catch (XMPPException e) {
throw new RuntimeException("Connect xmpp server", e);
}
try {
con.login(this.messageProducer, this.messageProducerPassword);
} catch (XMPPException e) {
throw new RuntimeException("login failed: " + e.getMessage() + " with "
+ messageProducer + ":" + messageProducerPassword);
}
return con;
}
private void sendMessage(String to, String message) {
try {
Chat newChat = chatmanager.createChat(to, new MessageListener() {
public void processMessage(Chat chat, Message message) {
}
});
newChat.sendMessage(message);
} catch (XMPPException e) {
log.error("Got error while sending message to " + to.getUsername(), e);
}
}
private void layout() {
if (con != null && con.isConnected()) {
con.disconnect();
}
}
}
- 第一次用openfire 服务器,用smack 发送消息
- openfire+smack消息发送
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- 基于Openfire消息服务器应用Smack发送即时消息源码示例
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Smack 结合 Openfire服务器,建立IM通信,发送聊天消息
- Android基于XMPP Smack Openfire开发IM【三】客户端接收服务器发送的消息
- Java Smack SDK 结合 Openfire服务器,建立IM通信,发送聊天消息
- Android基于XMPP Smack Openfire开发IM【三】客户端接收服务器发送的消息
- openfire smack文件发送
- 获得请求参数
- 获得存储过程返回值和输出参数有什么不同
- setsockopt 设置socket
- JSP处理中文参数乱码
- 深入解析Windows操作系统(Windows Internals) 4th Edition 读书笔记 - 第二章 系统结构 (二)
- 第一次用openfire 服务器,用smack 发送消息
- C++实现Photoshop色相/饱和度/明度功能
- Delphi用WebBrowser编程-自动登录操作
- 管理信息系统实验报告
- char vchar nchar nvchar的区别
- 学习JSON
- JSP中获得用户的使用的浏览器
- 给未来的电子工程师
- 今天我居然也被耍了.