I have a server running ons aws which is working well. Furthermore I have a smack 4.1.8 client on a android device and one more on a simple java applicaiton also running 4.1.8.
I would like to use socks5 for file transfer which I enabled on my server.
On my android device I just do some sending so there is only this code:
Socks5BytestreamManager manager = Socks5BytestreamManager.getBytestreamManager(connection);
try
{
Socks5BytestreamSession session = manager.establishSession("receiver@myserver/Smack");
File file = new File(fileToSend); ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
OutputStream oos = session.getOutputStream(); IOUtils.copy(ois, oos);
ois.close();
oos.close(); } catch (XMPPException | IOException | InterruptedException | SmackException e)
{
e.printStackTrace();
}
The java application gets configured like this:
socks5BytestreamManager = Socks5BytestreamManager.getBytestreamManager(xmppConnection);
socks5BytestreamManager.addIncomingBytestreamListener(new IncomingByteStreamListener());
and the code for receiving is this:
try {
Socks5BytestreamSession socks5BytestreamSession = request.accept();
InputStream ois = socks5BytestreamSession.getInputStream();
File file = new File(OutputHelper.DirectoryPath + "test");
if(file.exists())
{
file.delete();
}
file.createNewFile();
FileOutputStream fos = new FileOutputStream(file); IOUtils.copy(ois, fos);
ois.close();
fos.close(); } catch (InterruptedException | XMPPException.XMPPErrorException | SmackException | IOException e) {
e.printStackTrace();
}
When I try to send the file, I get the following message/error from the java application:
04:25:22 PM RECV (0): <iq from='sender@myserver/Smack' to='receiver@myserver/Smack' xml:lang='en' id='9Zjua-31' type='set'><query xmlns='http://jabber.org/protocol/bytestreams' sid='js5_4232423505050900029' mode='tcp'><streamhost jid='sender@myserver/Smack' host='fe80::5054:ff:fe12:3456%eth0' port='032777'/><streamhost jid='sender@myserver/Smack' host='10.0.2.15' port='032777'/><streamhost jid='proxy.myserver' host='010.0.0.101' port='032777'/></query></iq>
org.jivesoftware.smack.XMPPException$XMPPErrorException: Could not establish socket with any provided host
04:25:30 PM SENT (0): <iq to='sender@myserver/Smack' id='9Zjua-31' type='error'><error type='cancel'><item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Could not establish socket with any provided host</text></error></iq>
What am I missing? I have spent much time on google to solve this issue but couldn’t find anything usefull…
I would go about the
item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
part of the error, but so far I could not figure out anything.
Thanks for your help!