Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5927989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:14:30+00:00 2026-05-22T14:14:30+00:00

I’m trying to use Smack to transfer a file between two PCs connected on

  • 0

I’m trying to use Smack to transfer a file between two PCs connected on the same XMPP server, but I get a weird error.

To summarize, the destination PC has a FileTransferListener registered, like so:

ftm.addFileTransferListener(new FileTransferListener() {
  @Override
  public void fileTransferRequest(FileTransferRequest request) {
    System.out.println("Request received");
    if (true) // Check to see if the request should be accepted
    {
      // Accept it
      System.out.println("Entering FTListener because of FTRequest");
      IncomingFileTransfer transfer = request.accept();
      String id = request.getDescription();
      String path = savePoint + System.getProperty("file.separator") + request.getFileName();

      try
      {
        System.out.println("Receiving...");
        transfer.recieveFile(new File(path));
        // Information put in HashMap for later retrieval
        System.out.println("IM - putting in path (" + id + "," + path + ")");
        paths.put(id, path);
      } catch (XMPPException e) {
        logger.error("Error getting the VM file: " + e.getMessage());
      }
    }
    else
    {
      // Reject it
      request.reject();
      logger.info("VM file transfer rejected");
    }
  }
});

The source PC uses an OutgoingFileTransfer like so:

try
{
  String nick = destHost + "@" + this.conn.getServer() + "/Smack";
  //destHost = destination host name, conn = XMPP connection
  System.out.println("OFT to " + nick);
  OutgoingFileTransfer.setResponseTimeout(10000);
  OutgoingFileTransfer oft = ftm.createOutgoingFileTransfer(nick);
  oft.sendFile(f, name); //f = file to send, name = a message
  while (!oft.isDone())
  {
    if (oft.getStatus().equals(Status.error))
    {
      System.out.println("ERROR!!! " + oft.getError());
      oft.cancel();
      return false;
    }

    System.out.println(oft.getStatus());
    System.out.println(oft.getProgress());
    System.out.println("5 sec sleep");
    Thread.sleep(5000);
  }

  if (oft.getStatus().equals(Status.complete))
  {
    System.out.println("Transfer done");
    return true;
  }

  if (oft.getStatus().equals(Status.error))
    System.out.println("Transfer failed: " + oft.getError());
  return false;

} catch (XMPPException e) {
  System.out.println("Error sending VM image file with the FTM : " + e.getMessage());
  return false;

} catch (InterruptedException e) {
  System.err.println("Error sleeping during OFT : " + e.getMessage());
  return false;
}

When I try to send a file, the outgoing file transfer begins, and the destination PC receives the request, but the source PC cannot go further then the transfer negotiation.

This is seen in the source PC output…

Initial

0.0

2 sec sleep

Negotiating Transfer

0.0

2 sec sleep

Negotiating Stream

0.0

2 sec sleep

Transfer failed: null

I’m really annoyed because I don’t even get a proper error message, so I don’t really know what went wrong.

Has this ever happened to anyone else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:14:30+00:00Added an answer on May 22, 2026 at 2:14 pm

    Looks like you are running into a known issue in Smack that will hopefully be fixed in the next release.

    Update: This is now fixed and will be in version 3.2.1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.