我用eclipse写的android聊天软件连接不到本地openfire,初始配置都是从网上参考的,就是不行,
这是android的设置privatestaticvoidopenConnection(){try{if(null==connection||!connection.is...
这是android的设置
private static void openConnection() {
try {
if (null == connection || !connection.isAuthenticated()) {
// Create the configuration for this new connection
ConnectionConfiguration config = new ConnectionConfiguration(
"127.0.0.1", 5222);
// Sets if the connection is going to use stream
// compression.
config.setCompressionEnabled(false);
// Sets if the new connection about to be establish is going to
// be debugged.
config.setDebuggerEnabled(false);
// Sets if the reconnection mechanism is allowed to be used.
config.setReconnectionAllowed(true);
// Sets if the enable security verification
config.setSASLAuthenticationEnabled(false);
// Sets the TLS security mode used when making the connection.
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
// Sets if an initial available presence will be sent to the
// server.
config.setSendPresence(true);
connection = new XMPPConnection(config);
// Connect to the server
connection.connect();
}
} catch (XMPPException xe) {
xe.printStackTrace();
}
OPENFIRE服务器上的信息是这样的
服务器启动时间: 11 小时, 48 分钟 -- started 2018-4-20 23:39:00
版本: Openfire 4.2.3
Openfire 主目录: C:\Program Files (x86)\Openfire
服务器名称: desktop-p1aab4d
我的IPV4地址是192.168.43.7
到底我的android里的参数该怎么填,刚接触这东西不知道怎么弄
谢谢 展开
private static void openConnection() {
try {
if (null == connection || !connection.isAuthenticated()) {
// Create the configuration for this new connection
ConnectionConfiguration config = new ConnectionConfiguration(
"127.0.0.1", 5222);
// Sets if the connection is going to use stream
// compression.
config.setCompressionEnabled(false);
// Sets if the new connection about to be establish is going to
// be debugged.
config.setDebuggerEnabled(false);
// Sets if the reconnection mechanism is allowed to be used.
config.setReconnectionAllowed(true);
// Sets if the enable security verification
config.setSASLAuthenticationEnabled(false);
// Sets the TLS security mode used when making the connection.
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
// Sets if an initial available presence will be sent to the
// server.
config.setSendPresence(true);
connection = new XMPPConnection(config);
// Connect to the server
connection.connect();
}
} catch (XMPPException xe) {
xe.printStackTrace();
}
OPENFIRE服务器上的信息是这样的
服务器启动时间: 11 小时, 48 分钟 -- started 2018-4-20 23:39:00
版本: Openfire 4.2.3
Openfire 主目录: C:\Program Files (x86)\Openfire
服务器名称: desktop-p1aab4d
我的IPV4地址是192.168.43.7
到底我的android里的参数该怎么填,刚接触这东西不知道怎么弄
谢谢 展开
1个回答
2018-04-21
展开全部
填你的电脑的ip,别用127.0.0.1,这个表示Android自己本机
更多追问追答
追问
不行
追答
你电脑本地没配置服务器?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询