title: Finding the socks proxy port to set within System.setProperty("socksProxyPort") - windows java -
body: <p>i am trying to make an FTP connection  via HTTP using a proxy.
  i set the HTTP and HTTPS proxy host and port with the following code :</p>
  
  <pre><code>    system.setProperty("java.net.useSystemProxies","true");
      List&lt;Proxy&gt; l = null;
              try {
                  l = ProxySelector.getDefault().select(new URI("http://foo/bar"));
              } catch (URISyntaxException e) {
                  e.printStackTrace();
              }
              if (l != null) {
  
                  for (Iterator iter = l.iterator(); iter.hasNext();) {
                      java.net.Proxy proxy = (java.net.Proxy) iter.next()
  
                      InetSocketAddress addr = (InetSocketAddress) proxy.address();
  
                  if (addr != null) {
                      System.setProperty("http.proxyHost", addr.getHostName());
                      System.setProperty("http.proxyPort", Integer.toString(addr.getPort()));
                      System.setProperty("https.proxyHost", addr.getHostName());
                      System.setProperty("https.proxyPort", Integer.toString(addr.getPort()));    
                      System.setProperty("socksProxyHost",addr.getHostName());                            
                      System.setProperty("socksProxyPort","xxxx"  );  
  </code></pre>
  
  <p>i would like to know if is there a way to know wich one is the configured internet port (in the windows internet proxy control panel) about  the proxy to can set it at Runtime with the code :</p>
  
  <pre><code>System.setProperty("socksProxyPort") 
  </code></pre>
  
  <p>i need to do it without the user knows the port and choose it in the software before the connection becouse i would like to do it "automatically" as i can set the HTTP proxy getting the parameters from the system.</p>
  
  <p>I need this becouse i have a strange issue :
  If i dont set port number at runtime of the socks proxy my client could not make a PUT or GET request correctly using AXIS2 libraries and a webservice server IF in the windows internet options panel the proxy server is configured with the option : "use the same proxy server for all protocols"</p>
  
  <p>if i unflag that option and i set manually the socks addres (192.168.x.y  port 1080  ) , strangely, the connection goes on without the need to set by code the port with use the same proxy server for all protocols.</p>
  
  <p>I can also try to change the socks port using another one , es 808. I am able to connect with the server if in my code i set the same port with     System.setProperty("socksProxyPort","808") </p>