Proxy Server Understanding (1): Proxy server settings in a Windows environment

Source: Internet
Author: User

Proxy server settings in the browser

The proxy server settings provided by the Windows system interface are a global proxy setting, which is not explained here:

When using proxy settings, each browser can proactively obtain proxy settings or not use the proxy settings, such as Chrome browser if you want to use proxy settings, can only be changed in the location shown in the diagram, so simply (do not use accessible tools) to set up a proxy for Chrome, You can only change the system global proxy settings (without affecting processes that do not use the proxy settings at this time).

And 360 browsers can have several options:

It can use a proxy configured by its own program, use IE's proxy (which should be the system's global proxy settings), or not use a proxy, so that it can use a separate proxy configuration (even processes that use the system global proxy settings are unaffected).

Proxy servers in the Java process

Windows environment, in Java programming, the validation of one's own understanding, the code is as follows:

 PackageUserapp; Public  class localproxyhostprint{     Public Static void Main(string[] args) {//TODO auto-generated method stub         while(true) {System.out.println (System.getproperties (). GetProperty ("Http.proxyhost"));Try{Thread.Sleep ( +); }Catch(Interruptedexception e) {//TODO auto-generated catch blockE.printstacktrace (); }        }    }}

The code prints the current proxy server settings, and it turns out that when the proxy server setting does not set the system, it does not affect the results of Java printing, as the above code runs null.

Another Java program shows that under the same process, as long as the process is using Java code to set the proxy, all threads in the process use this proxy setting. The code is as follows:

Thread Code:

    publicvoidrun()    {        while(true)        {            System.out.println(System.getProperties().getProperty("http.proxyHost"));            try            {                Thread.sleep(1000);            catch (InterruptedException e)            {                // TODO Auto-generated catch block                e.printStackTrace();            }        }    }

The code for the main function:

System.getProperties().setProperty("http.proxyHost", myextractor.__v_ip.get(it));

Another program tested indicates that if process 1 sets the agent, process 2 does not set the proxy, and the proxy settings are printed with process 2, the result is null, which indicates that the proxy setting is dependent on the process, and the system's proxy settings are not global override, global mandatory settings, Its existence is equivalent to just putting a parameter in a system location, using this setting or not, but also by the process through the code to control.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Proxy Server Understanding (1): Proxy server settings in a Windows environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.