无法使用 Beem-Asmack 在 XMPP FileTransfer 中处理上传

Posted

技术标签:

【中文标题】无法使用 Beem-Asmack 在 XMPP FileTransfer 中处理上传【英文标题】:Cannot handle Uploading in XMPP FileTransfer using Beem-Asmack 【发布时间】:2012-05-04 23:58:41 【问题描述】:

我在处理从“android 聊天”到其他客户端(如 Pidgin)的文件传输时遇到问题:Pidgin 客户端收到传输请求,但我的应用程序无法开始传输文件。

我必须说我已经阅读了所有 ***s 问题,一些 http://community.igniterealtime.org/ 线程,但所有这些都没有解决我的问题。

为了测试,我在端口 5222 上使用 jabber.org 服务器,并且我使用 Beem-Asmack 库 v7(在某些客户端中,您还必须指定代理:这有必要吗??)。文件传输代码如下:

public boolean sendFile(final String jid, final String path, String description) 
    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(this.xmpp);
    /*if (sdm==null) 
        sdm = new ServiceDiscoveryManager(this.xmpp);*/
        sdm.addFeature("http://jabber.org/protocol/disco#info");
        sdm.addFeature("http://jabber.org/protocol/disco#item");
        sdm.addFeature("jabber:iq:privacy");
    //

    Log.d("sending file", "maganer");
    FileTransferNegotiator.setServiceEnabled(this.xmpp, true);
    FileTransferManager manage = new FileTransferManager(this.xmpp);
    Log.d("sending file", "set true");

    OutgoingFileTransfer.setResponseTimeout(10000);
    OutgoingFileTransfer oft = manage.createOutgoingFileTransfer(this.myRoster.getPresence(jid).getFrom());
    try 
        Log.d("sending file", "try to send... " + path);
        oft.sendFile(new File(path), description);
        Log.d("sending file", "Accepted");
        while (!oft.isDone()) 
            Log.d("status", oft.getStatus().toString());
            Log.d("percent", new Long(oft.getBytesSent()).toString());
            if (oft.getStatus() == FileTransfer.Status.error) 
                Log.e("percent", "Error " + new Long(oft.getBytesSent()).toString() + " " + oft.getError() + " " + oft.getException());
                oft.cancel();
                return false;
            
            //Thread.sleep(1000);
        
     catch (Throwable e) 
        e.printStackTrace();
        Log.e("sendFile", path);
        return false;
    
    return true;

我还在创建远程服务时执行以下过程

private void startup() 
    ProviderManager pm = ProviderManager.getInstance();
    // Private Data Storage
    pm.addIQProvider("query", "jabber:iq:private",
        new PrivateDataManager.PrivateDataIQProvider());

    // Time
    try 
        pm.addIQProvider("query", "jabber:iq:time",
            Class.forName("org.jivesoftware.smackx.packet.Time"));
     catch (ClassNotFoundException e) 
        Log.w("TestClient",
            "Can't load class for org.jivesoftware.smackx.packet.Time");
    

    // Roster Exchange
    pm.addExtensionProvider("x", "jabber:x:roster",
        new RosterExchangeProvider());

    // Message Events
    pm.addExtensionProvider("x", "jabber:x:event",
        new MessageEventProvider());

    // Chat State
    pm.addExtensionProvider("active",
        "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("composing",
        "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("paused",
        "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("inactive",
        "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("gone",
        "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    // Xhtml
    pm.addExtensionProvider("html", "http://jabber.org/protocol/xhtml-im",
        new XHTMLExtensionProvider());

    // Group Chat Invitations
    pm.addExtensionProvider("x", "jabber:x:conference",
        new GroupChatInvitation.Provider());

    // Service Discovery # Items
    pm.addIQProvider("query", "http://jabber.org/protocol/disco#items",
        new DiscoverItemsProvider());

    // Service Discovery # Info
    pm.addIQProvider("query", "http://jabber.org/protocol/disco#info",
        new DiscoverInfoProvider());

    // Data Forms
    pm.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());

    // MUC User
    pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user",
        new MUCUserProvider());

    // MUC Admin
    pm.addIQProvider("query", "http://jabber.org/protocol/muc#admin",
        new MUCAdminProvider());

    // MUC Owner
    pm.addIQProvider("query", "http://jabber.org/protocol/muc#owner",
        new MUCOwnerProvider());

    // Delayed Delivery
    pm.addExtensionProvider("x", "jabber:x:delay",
        new DelayInformationProvider());

    // Version
    try 
        pm.addIQProvider("query", "jabber:iq:version",
            Class.forName("org.jivesoftware.smackx.packet.Version"));
     catch (ClassNotFoundException e) 
        // Not sure what's happening here.
    

    // VCard
    pm.addIQProvider("vCard", "vcard-temp", new VCardProvider());

    // Offline Message Requests
    pm.addIQProvider("offline", "http://jabber.org/protocol/offline",
        new OfflineMessageRequest.Provider());

    // Offline Message Indicator
    pm.addExtensionProvider("offline",
        "http://jabber.org/protocol/offline",
        new OfflineMessageInfo.Provider());

    // Last Activity
    pm.addIQProvider("query", "jabber:iq:last", new LastActivity.Provider());

    // User Search
    pm.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());

    // SharedGroupsInfo
    pm.addIQProvider("sharedgroup",
        "http://www.jivesoftware.org/protocol/sharedgroup",
        new SharedGroupsInfo.Provider());

    // JEP-33: Extended Stanza Addressing
    pm.addExtensionProvider("addresses",
        "http://jabber.org/protocol/address",
        new MultipleAddressesProvider());

    // FileTransfer
    pm.addIQProvider("si", "http://jabber.org/protocol/si",
        new StreamInitiationProvider());

    pm.addIQProvider("query", "http://jabber.org/protocol/bytestreams",
        new BytestreamsProvider());

    pm.addIQProvider("open","http://jabber.org/protocol/ibb",
        new IBBProviders.Open());
    //
    pm.addIQProvider("close","http://jabber.org/protocol/ibb",
        new IBBProviders.Close());
    //
    pm.addExtensionProvider("data","http://jabber.org/protocol/ibb",
        new IBBProviders.Data());

    //
    pm.addExtensionProvider("x","jabber:x:data", new DataFormProvider());

    // Privacy
    pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());

    pm.addIQProvider("command", "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider());
    pm.addExtensionProvider("malformed-action",
        "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider.MalformedActionError());
    pm.addExtensionProvider("bad-locale",
        "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider.BadLocaleError());
    pm.addExtensionProvider("bad-payload",
        "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider.BadPayloadError());
    pm.addExtensionProvider("bad-sessionid",
        "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider.BadSessionIDError());
    pm.addExtensionProvider("session-expired",
        "http://jabber.org/protocol/commands",
        new AdHocCommandDataProvider.SessionExpiredError());

    //  Private Data Storage
    pm.addIQProvider("query","jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());

    // Time
    try 
        pm.addIQProvider("query","jabber:iq:time", Class.forName("org.jivesoftware.smackx.packet.Time"));
     catch (ClassNotFoundException e) 
        Log.w("TestClient", "Can't load class for org.jivesoftware.smackx.packet.Time");
    

    //  Roster Exchange
    pm.addExtensionProvider("x","jabber:x:roster", new RosterExchangeProvider());

    //  Message Events
    pm.addExtensionProvider("x","jabber:x:event", new MessageEventProvider());

    //  Chat State
    pm.addExtensionProvider("active", "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("composing", "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("paused", "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("inactive", "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    pm.addExtensionProvider("gone", "http://jabber.org/protocol/chatstates",
        new ChatStateExtension.Provider());

    //  XHTML
    pm.addExtensionProvider("html", "http://jabber.org/protocol/xhtml-im",
        new XHTMLExtensionProvider());

    //  Group Chat Invitations
    pm.addExtensionProvider("x", "jabber:x:conference", new GroupChatInvitation.Provider());

    //  Service Discovery # Items    
    pm.addIQProvider("query", "http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());

    //  Service Discovery # Info
    pm.addIQProvider("query", "http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());

    //  Data Forms
    pm.addExtensionProvider("x", "jabber:x:data", new DataFormProvider());

    //  MUC User
    pm.addExtensionProvider("x", "http://jabber.org/protocol/muc#user", new MUCUserProvider());

    //  MUC Admin    
    pm.addIQProvider("query", "http://jabber.org/protocol/muc#admin", new MUCAdminProvider());

    //  MUC Owner    
    pm.addIQProvider("query", "http://jabber.org/protocol/muc#owner", new MUCOwnerProvider());

    //  Delayed Delivery
    pm.addExtensionProvider("x","jabber:x:delay", new DelayInformationProvider());

    //  Version
    try 
        pm.addIQProvider("query","jabber:iq:version", Class.forName("org.jivesoftware.smackx.packet.Version"));
     catch (ClassNotFoundException e) 
        //  Not sure what's happening here.
    

    //  VCard
    pm.addIQProvider("vCard", "vcard-temp", new VCardProvider());

    //  Offline Message Requests
    pm.addIQProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageRequest.Provider());

    //  Offline Message Indicator
    pm.addExtensionProvider("offline", "http://jabber.org/protocol/offline", new OfflineMessageInfo.Provider());

    //  Last Activity
    pm.addIQProvider("query", "jabber:iq:last", new LastActivity.Provider());

    //  User Search
    pm.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());

    //  SharedGroupsInfo
    pm.addIQProvider("sharedgroup", "http://www.jivesoftware.org/protocol/sharedgroup", new SharedGroupsInfo.Provider());

    //  JEP-33: Extended Stanza Addressing
    pm.addExtensionProvider("addresses", "http://jabber.org/protocol/address", new MultipleAddressesProvider());

    //   FileTransfer
    pm.addIQProvider("si", "http://jabber.org/protocol/si", new StreamInitiationProvider());

    pm.addIQProvider("query", "http://jabber.org/protocol/bytestreams", new BytestreamsProvider());

    pm.addIQProvider("open", "http://jabber.org/protocol/ibb", new IBBProviders.Open());

    pm.addIQProvider("close", "http://jabber.org/protocol/ibb", new IBBProviders.Close());

    pm.addExtensionProvider("data", "http://jabber.org/protocol/ibb", new IBBProviders.Data());

    //  Privacy
    pm.addIQProvider("query", "jabber:iq:privacy", new PrivacyProvider());

    pm.addIQProvider("command", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider());
    pm.addExtensionProvider("malformed-action", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider.MalformedActionError());
    pm.addExtensionProvider("bad-locale", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider.BadLocaleError());
    pm.addExtensionProvider("bad-payload", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider.BadPayloadError());
    pm.addExtensionProvider("bad-sessionid", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider.BadSessionIDError());
    pm.addExtensionProvider("session-expired", "http://jabber.org/protocol/commands", new AdHocCommandDataProvider.SessionExpiredError());

现在我将描述我的错误:从日志记录中,我收到 -1 作为“百分比”和“协商流”作为“状态”。我不知道我错在哪里以及如何开始转移。感谢您的任何意见或建议。

编辑(2) 现在我通过添加部分解决了我的问题

FileTransferNegotiator.IBB_ONLY = true;

在初始化 FileTransferManager 和重新安排 ServiceDiscoveryManager 初始化之前,如下所示:

ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(this.xmpp);
     if (sdm==null)
         sdm = new ServiceDiscoveryManager(this.xmpp);
     sdm.addFeature("http://jabber.org/protocol/disco#info");
     sdm.addFeature("http://jabber.org/protocol/disco#item");
     sdm.addFeature("jabber:iq:privacy");

我还在启动时添加了以下配置:

SmackConfiguration.setPacketReplyTimeout(15000);

顺便说一句,现在我达到了与原始文件相同数量的进度值,但文件在接收方没有关闭。因此,超时被提高并且传输被中止。我如何传达文件的最终确定?似乎我传输了整个文件,即使其他客户端(Pidgin)没有处理它。再次提前感谢。

【问题讨论】:

sendFile 方法创建一个线程在后台发送文件。您可以尝试进行线程转储以查看该线程在做什么。当它完成传输文件时,它应该“关闭”流。在发送方,状态是否会更新为已完成? 感谢回复:不知道这次尝试了多少解决方案,差点放弃了……反正我尝试了这样修改类OutgoingFileTransfer:@ 987654322@我强制刷新,关闭,每个块都被发送(我也尝试在另一个版本中缓冲发送,以检查传输的数据量......),但是一个 0 长度的文件是已收到。所以发送部分终于完成了......我的问题是发送部分告诉我已经发送了所有文件,而接收仍在等待接收它。 啊:我的 Android 应用程序实际上收到了一个长度为 0 的文件。 再一次,新函数是 sendFile2,在第 214 行。 你说你在用 pidgin 进行测试?你能设置一个测试接收器,这样我们就可以从方程中消除另一个未知数。其他可能的选项是服务器没有转发 IBB 数据包或 pidgin 无法正确处理它们...... 【参考方案1】:
public void send()


    configureProviderManager(connection);
    FileTransferNegotiator.IBB_ONLY = true;
    FileTransferNegotiator.setServiceEnabled(connection, true);
    FileTransferManager manager = new FileTransferManager(connection);
    //OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("hariom@jabber.ccc.de/Smack");
    String to = connection.getRoster().getPresence("hariom@jabber.ccc.de").getFrom();
    OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(to);


    File file = new File("/sdcard/DCIM/Camera/1385869353956.jpg");
    try 
        Log.d("file sending",file.getAbsolutePath()+" "+file.getName());
        configureProviderManager(connection);
       transfer.sendFile(file, "test_file");
     catch (XMPPException e) 
       e.printStackTrace();
    

    while(!transfer.isDone()) 
        Log.d("status", transfer.getStatus().toString());
        Log.d("percent", new Long(transfer.getBytesSent()).toString());
        if (transfer.getStatus() == Status.error) 
            Log.e("percent", "Error " + new Long(transfer.getBytesSent()).toString() + " " + transfer.getError() + " " + transfer.getException());
            transfer.cancel();

        

        if(transfer.getStatus().equals(Status.refused))
                 System.out.println("refused  " + transfer.getError());
        else if( transfer.getStatus().equals(Status.error))
             System.out.println(" error " + transfer.getError());
        else if(transfer.getStatus().equals(Status.cancelled))
           System.out.println(" cancelled  " + transfer.getError());
        else
           System.out.println("Success");



    




public void configureProviderManager(XMPPConnection connection) 


    ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
    ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
    ProviderManager.getInstance().addIQProvider("query","http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());



    ProviderManager.getInstance().addIQProvider("query",
            "http://jabber.org/protocol/bytestreams",
            new BytestreamsProvider());
    ProviderManager.getInstance().addIQProvider("query",
            "http://jabber.org/protocol/disco#items",
            new DiscoverItemsProvider());
    ProviderManager.getInstance().addIQProvider("query",
            "http://jabber.org/protocol/disco#info",
            new DiscoverInfoProvider());

    ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
    if (sdm == null)
        sdm = new ServiceDiscoveryManager(connection);

    sdm.addFeature("http://jabber.org/protocol/disco#info");
    sdm.addFeature("http://jabber.org/protocol/disco#item");
    sdm.addFeature("jabber:iq:privacy");


    ProviderManager pm = ProviderManager.getInstance();

    // The order is the same as in the smack.providers file

    //  Private Data Storage
    pm.addIQProvider("query","jabber:iq:private", new PrivateDataManager.PrivateDataIQProvider());
    //  Time
    try 
        pm.addIQProvider("query","jabber:iq:time", Class.forName("org.jivesoftware.smackx.packet.Time"));
     catch (ClassNotFoundException e) 
        System.err.println("Can't load class for org.jivesoftware.smackx.packet.Time");
    

    //  Roster Exchange
    pm.addExtensionProvider("x","jabber:x:roster", new RosterExchangeProvider());
    //  Message Events
    pm.addExtensionProvider("x","jabber:x:event", new MessageEventProvider());
    //  Chat State
    pm.addExtensionProvider("active","http://jabber.org/protocol/chatstates", new ChatStateExtension.Provider());
    pm.addExtensionProvider("composing","http://jabber.org/protocol/chatstates", new ChatStateExtension.Provider());
    pm.addExtensionProvider("paused","http://jabber.org/protocol/chatstates", new ChatStateExtension.Provider());
    pm.addExtensionProvider("inactive","http://jabber.org/protocol/chatstates", new ChatStateExtension.Provider());
    pm.addExtensionProvider("gone","http://jabber.org/protocol/chatstates", new ChatStateExtension.Provider());

    //  XHTML
    pm.addExtensionProvider("html","http://jabber.org/protocol/xhtml-im", new XHTMLExtensionProvider());

    //  Group Chat Invitations
    pm.addExtensionProvider("x","jabber:x:conference", new GroupChatInvitation.Provider());
    //  Service Discovery # Items
    pm.addIQProvider("query","http://jabber.org/protocol/disco#items", new DiscoverItemsProvider());
    //  Service Discovery # Info
    pm.addIQProvider("query","http://jabber.org/protocol/disco#info", new DiscoverInfoProvider());
    //  Data Forms
    pm.addExtensionProvider("x","jabber:x:data", new DataFormProvider());
    //  MUC User
    pm.addExtensionProvider("x","http://jabber.org/protocol/muc#user", new MUCUserProvider());
    //  MUC Admin
    pm.addIQProvider("query","http://jabber.org/protocol/muc#admin", new MUCAdminProvider());
    //  MUC Owner
    pm.addIQProvider("query","http://jabber.org/protocol/muc#owner", new MUCOwnerProvider());
    //  Delayed Delivery
    pm.addExtensionProvider("x","jabber:x:delay", new DelayInformationProvider());
    pm.addExtensionProvider("delay", "urn:xmpp:delay", new DelayInformationProvider());
    //  Version
    try 
        pm.addIQProvider("query","jabber:iq:version", Class.forName("org.jivesoftware.smackx.packet.Version"));
     catch (ClassNotFoundException e) 
        System.err.println("Can't load class for org.jivesoftware.smackx.packet.Version");
    
    //  VCard
    pm.addIQProvider("vCard","vcard-temp", new VCardProvider());
    //  Offline Message Requests
    pm.addIQProvider("offline","http://jabber.org/protocol/offline", new OfflineMessageRequest.Provider());
    //  Offline Message Indicator
    pm.addExtensionProvider("offline","http://jabber.org/protocol/offline", new OfflineMessageInfo.Provider());
    //  Last Activity
    pm.addIQProvider("query","jabber:iq:last", new LastActivity.Provider());
    //  User Search
    pm.addIQProvider("query","jabber:iq:search", new UserSearch.Provider());
    //  SharedGroupsInfo
    pm.addIQProvider("sharedgroup","http://www.jivesoftware.org/protocol/sharedgroup", new SharedGroupsInfo.Provider());

    //  JEP-33: Extended Stanza Addressing
    pm.addExtensionProvider("addresses","http://jabber.org/protocol/address", new MultipleAddressesProvider());

    //   FileTransfer
    pm.addIQProvider("si","http://jabber.org/protocol/si", new StreamInitiationProvider());
    pm.addIQProvider("query","http://jabber.org/protocol/bytestreams", new BytestreamsProvider());
    pm.addIQProvider("open","http://jabber.org/protocol/ibb", new OpenIQProvider());
    pm.addIQProvider("data","http://jabber.org/protocol/ibb", new DataPacketProvider());
    pm.addIQProvider("close","http://jabber.org/protocol/ibb", new CloseIQProvider());
    pm.addExtensionProvider("data","http://jabber.org/protocol/ibb", new DataPacketProvider());

    //  Privacy
    pm.addIQProvider("query","jabber:iq:privacy", new PrivacyProvider());

    // SHIM
    pm.addExtensionProvider("headers", "http://jabber.org/protocol/shim", new HeadersProvider());
    pm.addExtensionProvider("header", "http://jabber.org/protocol/shim", new HeaderProvider());

    // PubSub
    pm.addIQProvider("pubsub", "http://jabber.org/protocol/pubsub", new PubSubProvider());
    pm.addExtensionProvider("create", "http://jabber.org/protocol/pubsub", new SimpleNodeProvider());
    pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub", new ItemsProvider());
    pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub", new ItemProvider());
    pm.addExtensionProvider("subscriptions", "http://jabber.org/protocol/pubsub", new SubscriptionsProvider());
    pm.addExtensionProvider("subscription", "http://jabber.org/protocol/pubsub", new SubscriptionProvider());
    pm.addExtensionProvider("affiliations", "http://jabber.org/protocol/pubsub", new AffiliationsProvider());
    pm.addExtensionProvider("affiliation", "http://jabber.org/protocol/pubsub", new AffiliationProvider());
    pm.addExtensionProvider("options", "http://jabber.org/protocol/pubsub", new FormNodeProvider());
    // PubSub owner
    pm.addIQProvider("pubsub", "http://jabber.org/protocol/pubsub#owner", new PubSubProvider());
    pm.addExtensionProvider("configure", "http://jabber.org/protocol/pubsub#owner", new FormNodeProvider());
    pm.addExtensionProvider("default", "http://jabber.org/protocol/pubsub#owner", new FormNodeProvider());
    // PubSub event
    pm.addExtensionProvider("event", "http://jabber.org/protocol/pubsub#event", new EventProvider());
    pm.addExtensionProvider("configuration", "http://jabber.org/protocol/pubsub#event", new ConfigEventProvider());
    pm.addExtensionProvider("delete", "http://jabber.org/protocol/pubsub#event", new SimpleNodeProvider());
    pm.addExtensionProvider("options", "http://jabber.org/protocol/pubsub#event", new FormNodeProvider());
    pm.addExtensionProvider("items", "http://jabber.org/protocol/pubsub#event", new ItemsProvider());
    pm.addExtensionProvider("item", "http://jabber.org/protocol/pubsub#event", new ItemProvider());
    pm.addExtensionProvider("retract", "http://jabber.org/protocol/pubsub#event", new RetractEventProvider());
    pm.addExtensionProvider("purge", "http://jabber.org/protocol/pubsub#event", new SimpleNodeProvider());

    // Nick Exchange
    pm.addExtensionProvider("nick", "http://jabber.org/protocol/nick", new Nick.Provider());

    // Attention
    pm.addExtensionProvider("attention", "urn:xmpp:attention:0", new AttentionExtension.Provider());

    //input
    pm.addIQProvider("si", "http://jabber.org/protocol/si",
            new StreamInitiationProvider());
    pm.addIQProvider("query", "http://jabber.org/protocol/bytestreams",
            new BytestreamsProvider());
    pm.addIQProvider("open", "http://jabber.org/protocol/ibb",
            new OpenIQProvider());
    pm.addIQProvider("close", "http://jabber.org/protocol/ibb",
            new CloseIQProvider());
    pm.addExtensionProvider("data", "http://jabber.org/protocol/ibb",
            new DataPacketProvider());


【讨论】:

您好,您的问题解决了吗,我在使用 xmpp 传输文件时遇到了同样的问题。我能够将文件发送到火花。但我收到它时遇到问题。

以上是关于无法使用 Beem-Asmack 在 XMPP FileTransfer 中处理上传的主要内容,如果未能解决你的问题,请参考以下文章

无法使用 HTTP 绑定连接到 XMPP 服务器(openfire)

XML 解析错误:“Not well-formed (invalid token)”,f***g/xmpp PHP library package with xmpp openfire

IOS:无法使用 XMPP 框架验证我的 JabberID

无法使用 asmack 版本 asmack-android-8-4.0.6.jar 在 xmpp 中返回组列表

无法使用 Node.js + XMPP 接收上游 GCM 消息

浅谈对xmpp的理解及应用