English 中文(简体)
十三、通过XMPP和开放式Fire进行转让
原标题:Android File Transfer not working via XMPP and OpenFire

www.un.org/Depts/DGACM/index_russian.htm Can t收到通过XMPP和开放式Fire服务器寄给我的和roid的档案。 我可以成功发送文件。 我使用的是asmack-jse-buddycloud-2010.12.11.jar

<><>>:>

    connConfig = new ConnectionConfiguration("beta.myCompany.co.uk", 5222);
    connConfig.setSASLAuthenticationEnabled(true);
    try {
        connect("username", "password");
    } catch (Exception e) {
        e.printStackTrace();
    }

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

    fileTransferManager = new FileTransferManager(connection);
    FileTransferNegotiator.setServiceEnabled(connection, true);

fileTransferManager.addFileTransferListener(new FileTransferListener() {
    @Override
    public void fileTransferRequest(FileTransferRequest request) {
        IncomingFileTransfer transfer = request.accept();
        try {
            FileOutputStream fos = openFileOutput(request.getFileName(), Context.MODE_PRIVATE);
            InputStream stream = transfer.recieveFile();//THIS FAILS!
            fos.write(IOUtils.toByteArray(stream));
            fos.close();    
        } catch (Exception e) {
            e.printStackTrace();
        }
}

<<>Error>(If file is sent through/60/7/em>:

Error in execution: -- caused by: java.util.concurrent.ExecutionException: No response from file transfer initiator:

<<>Error>(If file is sent through Adium:

java.util.concurrent.ExecutionException: Could not establish socket with any provided host: item-not-found(404) Could not establish socket with any provided host

<<>Error>(If file is sent through another case of my app:

Error in execution: -- caused by: java.util.concurrent.ExecutionException: -- caused by: No response from remote client:

www.un.org/spanish/ecosoc 我的原木:(在试图从中接收文件时)。

看来,我正在纠正这一错误! (未收到) 为什么这样做?

> 05-01 12:49:36.013: I/System.out(1000): 12:49:35 PM SENT (1093411736):
> <iq id="791-6222" to="beta.myCompany.co.uk"
> from="[email protected]/BAM-1918973529" type="error"><error
> code="501" type="CANCEL"><feature-not-implemented
> xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>

Extra Logs :

05-01 14:46:06.133: I/System.out(1370): 02:46:06 PM RCV  (1093401112): <iq id="eRi5A-72" to="[email protected]/BAM-1755858011" from="[email protected]/Spark 2.6.3" type="set"><si xmlns="http://jabber.org/protocol/si" id="jsi_5991130279184702850" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="Test.rtf" size="318"><desc>Sending file</desc></file><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="form"><field var="stream-method" type="list-single"><option><value>http://jabber.org/protocol/bytestreams</value></option><option><value>http://jabber.org/protocol/ibb</value></option></field></x></feature></si></iq>
05-01 14:46:08.283: I/System.out(1370): 02:46:08 PM SENT (1093401112): <iq id="eRi5A-72" to="[email protected]/Spark 2.6.3" from="[email protected]/BAM-1755858011" type="result"><si xmlns="http://jabber.org/protocol/si"><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field var="stream-method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>
05-01 14:46:08.312: I/System.out(1370): 02:46:08 PM RCV  (1093401112): <iq id="eRi5A-73" to="[email protected]/BAM-1755858011" type="get" from="[email protected]/Spark 2.6.3"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
05-01 14:46:14.352: W/System.err(1370): Error in execution: 
05-01 14:46:14.352: W/System.err(1370):   -- caused by: java.util.concurrent.ExecutionException: No response from file transfer initiator:[
[ERROR LOG IS HERE]
05-01 14:46:14.732: I/System.out(1370): 02:46:14 PM SENT (1093401112): <iq id="eRi5A-73" to="[email protected]/Spark 2.6.3" type="result"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="client" name="Smack" type="pc"/><feature var="http://jabber.org/protocol/caps"/><feature var="http://jabber.org/protocol/bytestreams"/><feature var="http://jabber.org/protocol/si/profile/file-transfer"/><feature var="http://jabber.org/protocol/si"/><feature var="http://jabber.org/protocol/ibb"/></query></iq>
05-01 14:46:14.773: I/System.out(1370): 02:46:14 PM RCV  (1093401112): <iq id="eRi5A-77" to="[email protected]/BAM-1755858011" type="set" from="[email protected]/Spark 2.6.3"><query xmlns="http://jabber.org/protocol/bytestreams" sid="jsi_5991130279184702850" mode="tcp"><streamhost jid="[email protected]/Spark 2.6.3" host="10.95.104.25" port="7777"/><streamhost jid="proxy.beta.myCompany.co.uk" host="127.0.1.1" port="7777"/></query></iq>
05-01 14:46:29.783: I/System.out(1370): 02:46:29 PM RCV  (1093401112): <iq type="get" id="537-7113" from="beta.myCompany.co.uk" to="[email protected]/BAM-1755858011"><ping xmlns="urn:xmpp:ping"/></iq>
05-01 14:46:29.843: I/System.out(1370): 02:46:29 PM SENT (1093401112): <iq id="537-7113" to="beta.myCompany.co.uk" from="[email protected]/BAM-1755858011" type="error"><error code="501" type="CANCEL"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
最佳回答

用途

transfer.receiveFile(myLocalFile);

而不是

InputStream stream = transfer.receive();

你们正在阻断包装材料。 第一种方法将预示自己阅读构成所转让部分的具体包装。 如果你使用第二种方法,你必须pa开自己的read子,做实际的文件读写。

问题回答

我制定了简便的Java方案,有一部分版本——其他用户代码——但+点是它正在发挥作用,即尝试了这个b/w。 当地人——SPark客户 - javaProgram

您可以寄出 t。 公开创建的其他用户档案 档案用户科。

Note : please change any thing if you want any details in Xmpp.test class .





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...