How file transfers work
What follows is information for advanced users.
Overview
File Transfer support is available since Gajim 0.8. It is implemented by socks5 bytestreams (XEP-0065 and XEP-0096. For information on file transfer over Jingle see: Jingle File Transfer.
The main objective is to provide a way of exchanging files between users over a stream independent of the XMPP servers, thus saving their resources.
The way it works
First of all, the initiator sends a request for a new file transfer, then the recipient of the file should send its response (accept/deny) to the initiator.
In the next step the initiator of the file transfer (sender) posts an iq with its own IP and a list of socks5 proxy servers. Then the recipient tries to establish a direct p2p connection to the sender. If it turns out to be impossible to establish a direct p2p connection, the recipient tries to connect to one of the socks5 proxies he got from the sender. If it succeeds, it notifies the sender about the proxy being used, and the file transfer can begin.
During the file transfer it is possible that the connection to the peer or the socks5 proxy is lost, or one of the peers cancels the transfer. In these cases both peers should be notified that the file transfer cannot be completed.
Possible problems and solutions
Until the date of writing this wiki, all socks5 proxy servers suffered from one problem:
It is impossible to send a file over socks5 proxy, if one of the peers contains non ascii characters in his jid or resource. In this case the contact that has a jid or resource containing non ascii characters should change it and relogin to his server. Only after that the transfer can be instantiated.
File transfer port (7777) can be filtered by your ISP:
You can check for filtering by typing one of the following commands:
telnet 208.245.212.98 7777
telnet 213.134.161.52 7777
telnet 129.16.79.37 7777
If a connection cannot be established to any of the hosts then your computer is probably behind a firewall filtering port 7777. You can ask your ISP to open the port to the specific proxies that Gajim uses or you can try to find a proxy that listens on a different port than 7777.
Another posible solution is described below:
You can also open the Advanced Configuration Editor and simply change the value of the key named "file_transfers_port" to an allowed port.
Forward port on your Gateway/Router
If you are behind NAT but you have access to your router, you can forward the port so that your computer is accessible through the translated port on your router. Let's say your internal IP address is 10.10.10.1 and your router's real IP 1.2.3.4, then all you have to do is tell the router to forward all connections to 1.2.3.4 on port 28011 to 10.10.10.1:28011.
After that open Advanced Configuration Editor and change the value of the key named "ft_override_host_to_send" to your real IP address (1.2.3.4), or if you have to the Hostname of your Dynamic DNS-Account.
Sample port forward
Sample port forward from 1.2.3.4:28011 to 10.10.10.1:28011 using iptables:
iptables -t nat -A PREROUTING -p tcp -d 1.2.3.4 --dport 28011 -j DNAT --to-destination 10.10.10.1:28011
iptables -A FORWARD -p tcp --dport 28011 -j ACCEPT
See more info on port forwarding and iptables.
Disable File Transfer Proxies
Open account preferences and uncheck 'Use file transfer proxies'.
Solving problems
If you find bugs or have ideas on how Gajim can be better, please open an Issue.
Tests
Here are the different tests we did for file transfers:
IBB (SI) | Socks5 (SI) | IBB (Jingle) | Socks5 (Jingle) | |
---|---|---|---|---|
Sender can be contacted directly | x | x | x | x |
Using sender proy | na | x | na | x |
Receiver can be contacted directly | na | na | na | x |
Using receiver proxy | na | na | na | x |