IO Error if smack cant use port for local proxy

Description

If smack try to create a local proxy for file transfer with a port that cant be used, it will lead to a IO-Exception.

Environment

None

Attachments

1

Activity

Robin Collier 
February 4, 2013 at 2:45 AM

I am closing this and opening a new documentation task to address this. Although it is documented in the code, it should also be added to the File Transfer documentation.

Florian Schmaus 
June 18, 2012 at 9:39 PM

I am not sure about this issue and fix.

1. The "isSetUp" bool is not needed. Better find some action (e.g. throw an exception) in the else case of "if (this.serverSocket != null)".
2. It would be much easier to just set the standard Socks5 Port to "-7777" in SmackConfiguration.java. That would result in the same behavior as this patch, without adding more LOC.

So to anyone who likes to run more than one instance of Smack on an host: Simply set the default port to a negative number. This is the workaround for this bug. Note that this is also documented (I am sure Henning had this in mind when he implemented this).

Tim Jentz 
October 20, 2011 at 1:46 PM

If a user try to run two clients on the same machine with local proxy, the second client can't establish a socket to the same port the first client is using (7777 per default).
If the default port is less then zero, smack will try to find a port which is not used. If the default port is above zero, smack want to use the specific port which can throw a IO Exception if the port cant be used.

This patch make smack to search for a free port if the default port cant be used.

Won't Fix

Details

Assignee

Reporter

Fix versions

Priority

Created October 20, 2011 at 1:45 PM
Updated October 28, 2020 at 8:46 AM
Resolved February 4, 2013 at 2:45 AM