Make Socks5Proxy try other ports if 7777 is already in use

by setting the default value to '-7777' (negative values mean that the
next port number will be tried if the current one is in use).
This commit is contained in:
Florian Schmaus 2014-08-05 09:32:13 +02:00
parent d65d239550
commit 5c2f051c1c
1 changed files with 6 additions and 1 deletions

View File

@ -73,7 +73,12 @@ public class Socks5Proxy {
private static Socks5Proxy socks5Server;
private static boolean localSocks5ProxyEnabled = true;
private static int localSocks5ProxyPort = 7777;
/**
* The port of the local Socks5 Proxy. If this value is negative, the next ports will be tried
* until a unused is found.
*/
private static int localSocks5ProxyPort = -7777;
/* reusable implementation of a SOCKS5 proxy server process */
private Socks5ServerProcess serverProcess;