Filetransfer faild with this message

hi.

I have made file transfer program with smack

But when I excute this code, I got message

10-26 12:16:12.599: INFO/System.out(1815): Status :: Error Error :: The peer did not find any of the provided stream mechanisms acceptable. Exception :: (400)

The peer did not find any of the provided stream mechanisms acceptable.

How can I overcome this message??

thx >.<

(Sorry, My English is very low . T.T)

ServiceDiscoveryManager sm=new ServiceDiscoveryManager(Login.getCon());

manager = new FileTransferManager(Login.getCon());

FileTransferNegotiator.setServiceEnabled(Login.getCon(),true);

// Create the outgoing file transfer

OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(roster.getPresence(friends.get(j).getJid()). getFrom());

// Send the file

try {

Log.d(“status”,transfer.getStatus().toString()+“1”);

transfer.sendFile(new File("/sdcard/figure1.gif"), “test”);

Log.d(“status”,transfer.getStatus().toString()+“2”);

} catch (XMPPException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

try {

Thread.sleep(1000);

}

catch(Exception e){}

System.out.println("Status :: " + transfer.getStatus() + " Error :: " + transfer.getError() + " Exception :: " + transfer.getException());

System.out.println("Is it done? " + transfer.isDone());

Do you have this method < public void configure(ProviderManager pm) > from this thread http://www.igniterealtime.org/community/message/167989#167989 ?

Hi wmhtet.
I tried to use configure().
When I use to smack.jar (android version). So I can’t find AdHocCommandDataProvider. And if I import smackx, I get also this error.

java.lang.IllegalArgumentException: already added: Lorg/jivesoftware/smackx/ChatState;

Do you have perfect android version ?

T.T

I don’t have a jar file. I just use them from source. If you are interested, I have attached my patched source.
aunndroid-smack.tar (2355200 Bytes)

Thank you.

I appreciate your help.

But… >.< I complete this problems…

When I send file , I get 3 types error.

first situation.

File f = new File("/sdcard/figure1.gif");

    InputStream in = null;
byte[] pix = null;
try {
  in = new FileInputStream(f);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  byte[] b = new byte[1024];
  int len;
  while ((len = in.read(b)) != -1) {
    baos.write(b, 0, j);
  }
  pix = baos.toByteArray();

OutputStream stream = transfer.sendFile(f.getName(), pix.length,“dd”);
stream.write(pix);
stream.flush();
stream.close();

-> error message

10-27 20:00:39.378: INFO/System.out(1793):

08:00:39 PM SENT (1131861264): ddhttp://jabber.org/protocol/bytestreamshttp://jabber.org/protocol/ibb

10-27 20:00:47.449: INFO/System.out(1793): 08:00:47 PM RCV (1131861264): http://jabber.org/protocol/bytestreams

10-27 20:00:47.488: INFO/System.out(1793): 08:00:47 PM SENT (1131861264):

10-27 20:00:56.858: INFO/System.out(1793): 08:00:56 PM RCV (1131861264): <iq from="demon95@xmpp.jp/Coccinella@1b3fd11ad9d3437"

to="demon95@xmpp.kr/www.aunndroid.com" xml:lang=“en” type=“error” id=“iB1xd-16”>

10-27 20:00:56.898: WARN/System.err(1793): Error establishing transfer socket:
10-27 20:00:56.908: WARN/System.err(1793): – caused by: Unexpected response from remote user:
10-27 20:00:56.922: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.createOutgoingStr eam(Socks5TransferNegotiator.java:260)
10-27 20:00:56.927: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(Outgo ingFileTransfer.java:374)
10-27 20:00:56.937: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.sendFile(OutgoingFile Transfer.java:123)

10-27 20:00:57.072: WARN/System.err(1793): Nested Exception:
10-27 20:00:57.080: WARN/System.err(1793): Unexpected response from remote user:
10-27 20:00:57.117: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.waitForUsedHostRe sponse(Socks5TransferNegotiator.java:339)
10-27 20:00:57.138: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.initBytestreamSoc ket(Socks5TransferNegotiator.java:299)
10-27 20:00:57.138: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.createOutgoingStr eam(Socks5TransferNegotiator.java:257)
10-27 20:00:57.138: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(Outgo ingFileTransfer.java:374)
10-27 20:00:57.158: WARN/System.err(1793): at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.sendFile(OutgoingFile Transfer.java:123)

T,.T

second situation.

try {
transfer.sendStream(new FileInputStream(f), f.getName(), f.length(), “dd”);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

log message ->

10-27 20:05:43.108: INFO/System.out(2245): 08:05:43 PM RCV (1131861360): http://jabber.org/protocol/bytestreams

10-27 20:05:43.148: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):
10-27 20:05:43.177: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):

10-27 20:05:43.197: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):

10-27 20:05:43.227: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):

10-27 20:05:43.237: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):

10-27 20:05:43.267: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):

10-27 20:05:43.278: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):

10-27 20:05:43.307: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):

10-27 20:05:43.337: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):
10-27 20:05:43.360: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):

10-27 20:05:43.378: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):

10-27 20:05:43.417: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):
10-27 20:05:43.458: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):
10-27 20:05:43.491: INFO/System.out(2245): 08:05:43 PM RCV (1131861360):
10-27 20:05:43.769: DEBUG/dalvikvm(2245): GC freed 6715 objects / 421608 bytes in 144ms
10-27 20:05:43.849: INFO/System.out(2245): 08:05:43 PM SENT (1131861360):
10-27 20:05:52.968: INFO/System.out(2245): 08:05:52 PM RCV (1131861360):
10-27 20:06:13.893: INFO/System.out(2245): 08:06:13 PM SENT (1131861360):

As a fact, I don’t understand this log message…

Do you possible file trasnfer in android?

Thank you ><

file transfer in android over gtalk is possible for small file size of 200-300Kb. if you have your own xmpp server(open fire), it will be different (you can test it out using www.igniterealtime.org but I don’t know about other xmpp server implementation). file transfer implementations among the xmpp clients are also different and will not work between two different clients most of the time. I see that you are testing against Coccinella. I would suggest you to start simple. Use Spark client and www.igniterealtime.org accounts (or your own openfire server) to test the file transfer. Use Wireshark to see the packets going between the clients to analyze the transfer.