HOW TO: force a specific StreamHost for mediated file transfer

Hi Smack Community,

I’m prototyping a file transfer implementation where I’m using the SMACK/SMACKX api embedded in a webapp alongside vysper - also embedded in the same webapp. We only wish to support Mediated Connections right now.

So, my file processing logic will act as both a RECEIVER and a SENDER, but for now, I’m just trying to get the RECEIVING working. I’m using PSI as the client that’s initiating the file transfer. The problem is, PSI is sending JID(s) for itself (i.e. Direct Connection) + the Data Transfer Proxy, and the SMACK code is selecting the first StreamHost in the list - which is not the Vysper Socks5 Proxy (Mediated Connection).

Therefore, I’d like to know if there’s a way to specify in my SMACK configuration/connection the ONLY streamhost JID that I want to support in my embedded file transfer processing logic.

Thanks in advance,


That’s a situation where I find myself also sometimes in: The sender of the file also sends the possible streamhost candidates, and the receiver (e.g. SMACK) selects the first one, which is in many cases the local IP of the sender, which is often not accessible from outside networks, e.g. when the sender is behind a NAT router.

The receiver should try to connect to the streamhosts in order they are send, since the order also asigns a priority to the streamhosts. And if he can not connect to the first, the seconds streamhost is selected, which is usually a streamhost with an public IP (often hosted by the service that also acts as XMPP server). In fact this in done by SMACK as it can be seen in ckx/bytestreams/socks5/

So your problem lies somewhere else. A trace of the stanzas involved in the file transfer should help you to figure out what is wrong.