[英]connect to xmpp server
i try to connect to my xmpp server by this code 我尝试通过此代码连接到我的xmpp服务器
final String servicename = "my server ip";
XMPPTCPConnection connection;
public void Register(String userName, String password)throws XMPPException, SmackException, IOException
{
try{
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setServiceName(servicename)
.setUsernameAndPassword("admin username", "admin password")
.setCompressionEnabled(false).build();
connection = new XMPPTCPConnection(config);
connection.connect();
AccountManager AM = AccountManager.getInstance(connection);
AM.createAccount(userName, password);
connection.disconnect();
System.out.println(":)");
}
catch(XMPPException e){
System.out.println(":(");
}
}
all the code is in try catch but when i call this function nothing gets printed and get error. 所有的代码都在try catch中,但是当我调用此函数时,没有任何输出并得到错误。
I'm new to java but i think it is getting error from config declaration 我是Java的新手,但我认为它从配置声明中出错
i copy config declaration from here 我从这里复制配置声明
how can i fix this? 我怎样才能解决这个问题?
thanks in advance 提前致谢
我终于找到answer.it似乎嫌4后,你需要一些更多的jar文件添加到您的项目和解决我的问题,其中之一就是这个
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.