2012-04-23 15 views
26

का उपयोग कर फ़ाइल स्थानांतरण के दौरान त्रुटि मुझे एस्मैक का उपयोग करके फ़ाइल प्राप्त करते समय कोई समस्या है। यहाँ मैं त्रुटि और पैकेट कि मैं भेजा पेस्ट और लॉगरिमोट क्लाइंट से कोई प्रतिक्रिया नहीं: Asmack

// error 
04-21 19:21:05.109: WARN/System.err(7401): Error in execution: 
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: java.util.concurrent.ExecutionException: 
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: No response from remote client: 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:199) 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFileTransfer.java:47) 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTransfer.java:124) 
04-21 19:21:05.109: WARN/System.err(7401):  at java.lang.Thread.run(Thread.java:1019) 
04-21 19:21:05.109: WARN/System.err(7401): Nested Exception: 
04-21 19:21:05.109: WARN/System.err(7401): java.util.concurrent.ExecutionException: 
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: No response from remote client: 
04-21 19:21:05.109: WARN/System.err(7401):  at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:234) 
04-21 19:21:05.109: WARN/System.err(7401):  at java.util.concurrent.FutureTask.get(FutureTask.java:91) 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:193) 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.access$100(IncomingFileTransfer.java:47) 
04-21 19:21:05.109: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$1.run(IncomingFileTransfer.java:124) 
04-21 19:21:05.109: WARN/System.err(7401):  at java.lang.Thread.run(Thread.java:1019) 
04-21 19:21:05.109: WARN/System.err(7401): Caused by: 
04-21 19:21:05.109: WARN/System.err(7401): -- caused by: No response from remote client: 
04-21 19:21:05.167: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.FaultTolerantNegotiator.createIncomingStream(FaultTolerantNegotiator.java:113) 
04-21 19:21:05.167: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$2.call(IncomingFileTransfer.java:186) 
04-21 19:21:05.217: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer$2.call(IncomingFileTransfer.java:183) 
04-21 19:21:05.217: WARN/System.err(7401):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306) 
04-21 19:21:05.217: WARN/System.err(7401):  at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
04-21 19:21:05.236: WARN/System.err(7401):  at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(IncomingFileTransfer.java:190) 
04-21 19:21:05.236: WARN/System.err(7401):  ... 3 more 




// packets sent and received: 
04-21 19:20:53.177: INFO/System.out(7401): 07:20:53 PM RCV (1079262448): <presence from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-22'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack/' ver='zAGnwwThW7wuhrojiPg9I4Spwms='/></presence> 
04-21 19:20:54.479: INFO/System.out(7401): 07:20:54 PM RCV (1079262448): <presence from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-23'><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack/' ver='zAGnwwThW7wuhrojiPg9I4Spwms='/></presence> 
04-21 19:20:54.602: INFO/System.out(7401): 07:20:54 PM RCV (1079262448): <iq from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-24' type='set'><si xmlns='http://jabber.org/protocol/si' id='jsi_5262843704368872277' profile='http://jabber.org/protocol/si/profile/file-transfer'><file xmlns='http://jabber.org/protocol/si/profile/file-transfer' name='rails.png' size='6646'><desc>rails.png</desc></file><feature xmlns='http://jabber.org/protocol/feature-neg'><x xmlns='jabber:x:data' type='form'><field var='stream-method' type='list-multi'><option><value>http://jabber.org/protocol/bytestreams</value></option><option><value>http://jabber.org/protocol/ibb</value></option></field></x></feature></si></iq> 
04-21 19:20:54.639: DEBUG/Lisner Called(7401): Incoming Listner 
04-21 19:20:54.658: DEBUG/file name(7401): rails.png 
04-21 19:20:54.658: DEBUG/file status(7401): Initial 
04-21 19:20:54.658: DEBUG/file size(7401): 6646 
04-21 19:20:54.684: DEBUG/file path(7401): /mnt/sdcard/DCIM/Camera/rails.png 
04-21 19:20:54.684: DEBUG/Receive(7401): before receive 
04-21 19:20:54.712: DEBUG/R1(7401): after receive 
04-21 19:20:54.772: INFO/System.out(7401): 07:20:54 PM SENT (1079262448): <iq id="fDXhN-24" to="[email protected]/Smack" from="[email protected]/Smack" 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><value>http://jabber.org/protocol/ibb</value></field></x></feature></si></iq> 
04-21 19:20:55.724: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:20:56.765: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:20:57.810: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:20:58.330: INFO/System.out(7401): 07:20:58 PM RCV (1079262448): <iq from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-26' type='set'><query xmlns='http://jabber.org/protocol/bytestreams' sid='jsi_5262843704368872277' mode='tcp'><streamhost jid='[email protected]/Smack' host='127.0.0.1' port='7777'/></query></iq> 
04-21 19:20:58.425: INFO/System.out(7401): 07:20:58 PM SENT (1079262448): <iq id="fDXhN-26" to="[email protected]/Smack" from="[email protected]/Smack" type="error"><query xmlns="http://jabber.org/protocol/bytestreams" sid="jsi_5262843704368872277" mode = "tcp"><streamhost jid="[email protected]/Smack" host="127.0.0.1" port="7777"/></query><error code="404" type="CANCEL"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Could not establish socket with any provided host</text></error></iq> 
04-21 19:20:58.874: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:20:59.943: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:21:00.765: INFO/System.out(7401): 07:21:00 PM RCV (1079262448): <iq from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-27' type='set'><open xmlns='http://jabber.org/protocol/ibb' block-size='4096' sid='jsi_5262843704368872277' stanza='iq'/></iq> 
04-21 19:21:00.804: INFO/System.out(7401): 07:21:00 PM SENT (1079262448): <iq id="fDXhN-27" to="[email protected]/Smack" from="[email protected]/Smack" type="error"><error code="501" type="CANCEL"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq> 
04-21 19:21:00.978: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:21:02.017: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:21:03.039: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:21:04.071: INFO/transfere file(7401): receiving file status Negotiating Stream progress: 0.0 
04-21 19:21:05.109: INFO/transfere file(7401): receiving file status Error progress: 0.0 
+0

यदि आपको समाधान मिल गया है तो आप मेरी मदद कर सकते हैं, मेरे चैट एप ejabberd सर्वर के साथ और एंड्रॉइड क्लाइंट्स के बीच ठीक से काम कर रहे हैं, लेकिन जब मैं 0.0 पर फंसने की प्रगति की तुलना में कोई फ़ाइल भेजता हूं .. क्या कारण हो सकता है? – nitesh

उत्तर

1

प्राप्त अपने कोड अपनी हार्ड देखकर समस्या का मूल्यांकन करने के बिना। हालांकि, मुझे मूल रूप से आपके जैसा ही समस्या थी क्योंकि मैं InputStream stream = transfer.recieveFile(); का उपयोग कर रहा था। यह transfer.recieveFile(new File(getExternalFilesDir(null), transfer.getFileName())); का उपयोग कर तय किया गया था। आपके लॉग से इस तरह श्रोता जोड़ने का प्रयास करें ...

fileTransferManager.addFileTransferListener(new FileTransferListener() { 
    @Override 
    public void fileTransferRequest(FileTransferRequest request) { 
     try { 
      IncomingFileTransfer transfer = request.accept(); 
      transfer.recieveFile(new File(getExternalFilesDir(null), transfer.getFileName())); 
      String line; 
      BufferedReader br = new BufferedReader(new FileReader(new File(getExternalFilesDir(null), transfer.getFileName()))); 
      while ((line = br.readLine()) != null) { 
       System.out.println(line); 
      } 
     } catch (Exception e) { 
       e.printStackTrace(); 
     } 
    } 
}); 
1

: क्योंकि वहाँ केवल

04-21 19:20:58.330: INFO/System.out(7401): 07:20:58 PM RCV (1079262448): <iq from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-26' type='set'><query xmlns='http://jabber.org/protocol/bytestreams' sid='jsi_5262843704368872277' mode='tcp'><streamhost jid='[email protected]/Smack' host='127.0.0.1' port='7777'/></query></iq> 
04-21 19:20:58.425: INFO/System.out(7401): 07:20:58 PM SENT (1079262448): <iq id="fDXhN-26" to="[email protected]/Smack" from="[email protected]/Smack" type="error"><query xmlns="http://jabber.org/protocol/bytestreams" sid="jsi_5262843704368872277" mode = "tcp"><streamhost jid="[email protected]/Smack" host="127.0.0.1" port="7777"/></query><error code="404" type="CANCEL"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Could not establish socket with any provided host</text></error></iq> 
.... 
04-21 19:21:00.765: INFO/System.out(7401): 07:21:00 PM RCV (1079262448): <iq from='[email protected]/Smack' to='[email protected]/Smack' id='fDXhN-27' type='set'><open xmlns='http://jabber.org/protocol/ibb' block-size='4096' sid='jsi_5262843704368872277' stanza='iq'/></iq> 
04-21 19:21:00.804: INFO/System.out(7401): 07:21:00 PM SENT (1079262448): <iq id="fDXhN-27" to="[email protected]/Smack" from="[email protected]/Smack" type="error"><error code="501" type="CANCEL"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq> 

bytestream transfer method failes, एक स्थानीय (127.0.0.1) streamhost कॉन्फ़िगर किया गया। in-band bytestream विफल रहता है क्योंकि दूसरी पार्टी आईबीबी का समर्थन नहीं करती है।

आप करना चाहिए: एक वैध streamhost कि प्रॉक्सी के रूप में कार्य करता है

4

Dude बस कोड को कॉपी करके निम्न पेस्ट,

private void receiveFile(XMPPConnection connection2) { 
    // TODO Auto-generated method stub 
    if(connection2 != null){ 
     ServiceDiscoveryManager sdm =  ServiceDiscoveryManager.getInstanceFor(connection2); 
     if (sdm == null){ 
      sdm = new ServiceDiscoveryManager(connection2); 
     } 
     sdm.addFeature("http://jabber.org/protocol/disco#info"); 
     sdm.addFeature("jabber:iq:privacy"); 
     FileTransferManager manager = new FileTransferManager(connection2); 

     manager.addFileTransferListener(new FileTransferListener() { 

      public void fileTransferRequest(final FileTransferRequest request) { 
       new Thread(){ 

        @Override 
        public void run() { 
         IncomingFileTransfer transfer = request.accept();       
         File mf = Environment.getExternalStorageDirectory();     
         final File file = new File(mf.getAbsoluteFile() +"/"+ transfer.getFileName()); 
         try{ 
          transfer.recieveFile(file); 
          while(!transfer.isDone()){ 
           try{ 
            Thread.sleep(1000); 
           } 
           catch (Exception e) { 
            Log.e("", e.getMessage()); 
           } 
           if(transfer.getStatus().equals(Status.error)) { 
            Log.e("ERROR!!! ", transfer.getError() + ""); 
           } 
           if(transfer.getException() != null) { 
            transfer.getException().printStackTrace(); 
           } 
          } 
          handler.post(new Runnable() { 

           @Override 
           public void run() { 
            // TODO Auto-generated method stub 
            String xMsg = textViewSent.getText().toString(); 
            String newMessage = "File Received at "+file.getAbsolutePath(); 
            textViewSent.setText("\n"+xMsg+"\n"+newMessage); 
           } 
          }); 
         } 
         catch (Exception e) { 
          e.printStackTrace(); 
         }       
        }; 
        }.start(); 
      } 
     }); 
    } 

कृपया वोट देना याद रखें ...

संबंधित मुद्दे