Ultrasurf is an awesome way to use remote proxies via a locally created proxy server. As mentioned in my previous post, you can either set the browser proxy settings to use 127.0.0.1 (localhost) as the IP address and 9666 as the port number. This is the default setting used by Ultrasurf, which acts as a local proxy server and connects to remote proxies.
There could be situation where we have such a requirement. Suppose you are accessing a website via Ultrasurf and the website blocks the specific proxy IP address. In this case you will have to change the remote proxy server used by Ultrasurf. One way of doing this is via the Ultrasurf user interface, which gives an option of choosing one of three servers. However, it is not easy to programmatically change the remote proxy server Ultrasurf uses.
Note that, if you close the Ultrasurf application and reopen it, most of the time it connects to a new remote proxy server. Hence, a solution for the above problem is to close and reopen the Ultrasurf application as and when you need to change the remote proxy server used by Ultrasurf. This can be achieved from the following simple python code.