Asutosh11 / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Cannot initiate a file transfer #61

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What are you doing to produce the error?
1. FileTransferManager manager = new FileTransferManager(connection);
2. final OutgoingFileTransfer transfer = 
manager.createOutgoingFileTransfer(jid);
3. transfer.sendFile(file, "My funny file");
4. Watch the xmpp log and see the originator advertising the streamhost
<streamhost jid="myid@mydomain.com/smack" host="127.0.0.1" port="7777"/>

What is the expected output?
The expected output is to have the transfer succeed

What do you see instead? (Please attach a debug enabled logcat)
<streamhost jid="myid@mydomain.com/smack" host="127.0.0.1" port="7777"/>

What version of aSmack / Android / Device do you use?
asmack-2010.05.07 / 2.2 / Galaxy GT-I9000

What server do you use? Is there a public server to reproduce the problem?
Openfire, latest

What else might help us to reproduce and hunt down the problem?
Actually I have also the solution. As reported, InetAddress.getLocalHost() 
returns "127.0.0.1" which of course is not what we want. I replaced the code 
for  
org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.discoverLocalIP() 
as follows

    private String discoverLocalIP() throws UnknownHostException {
        try {
            for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress = enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress()) {
                        return inetAddress.getHostAddress().toString();
                    }
                }
            }
        } catch (SocketException ex) {
            Logger.error("Error retrieving the local IP", ex);
        }
        throw new UnknownHostException("Failed to retrieve local IP");
        //return InetAddress.getLocalHost().getHostAddress();
    }

Original issue reported on code.google.com by bmata...@gmail.com on 17 Jun 2011 at 2:01

GoogleCodeExporter commented 8 years ago
i cannot find the method discoverLocalIP() 
org.jivesoftware.smackx.filetransfer.Socks5TransferNegotiator.discoverLocalIP().
 I dowloaded the source of snack from 
http://www.igniterealtime.org/downloads/source.jsp

Original comment by xardo...@gmail.com on 9 Aug 2011 at 7:32

GoogleCodeExporter commented 8 years ago
I did not find the method discoverLocalIP() yet.
:((

Original comment by yulin...@gmail.com on 17 Nov 2011 at 1:55

GoogleCodeExporter commented 8 years ago
It is about asmack (smack for Android), not the regular desktop smack.

Original comment by bmata...@gmail.com on 17 Nov 2011 at 2:07

GoogleCodeExporter commented 8 years ago
please share us your jar file after complied.

Original comment by zhengkan...@gmail.com on 22 Nov 2012 at 1:00

GoogleCodeExporter commented 8 years ago
Was working on asmack and faced this same issue,

but it seems that in the current version of asmack, the code responsible for 
fetching the localIP resides in  
org/jivesoftware/smackx/bytestreams/socks5/Socks5Proxy.java

this function needs to be added to Socks5Proxy.java
and properly invoked from inside its Constructor.

(have attached the changed Socks5Proxy.java file)

P.S. somehow I couldn't find a mention of this issue on the github 

Original comment by narendra...@gmail.com on 4 May 2013 at 8:07

GoogleCodeExporter commented 8 years ago
attached again

Original comment by narendra...@gmail.com on 4 May 2013 at 8:08

Attachments: