简体   繁体   English

smack api 中的连接问题

[英]Connection problem in smack api

I am using smack api for file transfer, there am using connetion我正在使用 smack api 进行文件传输,正在使用连接

ConnectionConfiguration connConfig = new ConnectionConfiguration(
            "198.162.1.24",5222);

but i know that port 7777 for filetransfer,when I try to connect with that, my android app becomes force closed because of not connecting to the server.但我知道用于文件传输的端口7777 ,当我尝试与之连接时,我的 android 应用程序由于未连接到服务器而被强制关闭。

how do I transfer the file..怎么传文件啊。。

thanks in advance.提前致谢。

first make sure you are not using the native smack jar you need the ported or the patched one (asmack) to because native smack wont work n android首先确保您没有使用本机 smack jar 您需要移植或修补的(asmack),因为本机 smack 无法工作 n android

then try these configurations然后尝试这些配置

   SmackConfiguration.setPacketReplyTimeout(15000);
   ConnectionConfiguration connectionConfig = new ConnectionConfiguration(host, port);
   connectionConfig.setRosterLoadedAtLogin(true);
   connectionConfig.setSendPresence(true);
   connectionConfig.setSASLAuthenticationEnabled(false);
   connectionConfig.setReconnectionAllowed(true);
   connection = new XMPPConnection(connectionConfig);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM