简体   繁体   中英

Connection problem in smack api

I am using smack api for file transfer, there am using connetion

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.

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

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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