Knowasiak community

Social networking platform full of Knowledge © 2020-22

How to test whether your proxy is really working or not?

First of all what is proxy?

Diagram of two computers connected only via a proxy server. The first computer says to the proxy server: "ask the second computer what the time is".

Communication between two computers (shown in grey) connected through a third computer (shown in red) acting as a proxy. Bob does not know to whom the information is going, which is why proxies can be used to protect privacy.

In computer networks, a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers.[1] A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server and the proxy server evaluates the request as a way to simplify and control its complexity. Proxies were invented to add structure and encapsulation to distributed systems.[2]Today, most proxies are web proxies, facilitating access to content on the World Wide Web, providing anonymity and may be used to bypass IP address blocking.

I’ve currently these codes answered below to check the proxy:


2.Although somewhat old question, but it may be still have some value to provide another answer. So here is mine:

set_proxies() {
    export http_proxy=
    export HTTP_PROXY=${http_proxy}
    export https_proxy=
    export HTTPS_PROXY=${https_proxy}
    export ftp_proxy=
    export FTP_PROXY=${ftp_proxy}
    export socks_proxy=socks://
    export SOCKS_PROXY=${socks_proxy}
    export no_proxy=localhost,,,
    export NO_PROXY=${no_proxy}        
    export all_proxy=socks5://   


curl -s -m 2 $URL > /dev/null

if [ $? == 0 ] then
    STATUS="No Corporate Proxy"
    STATUS="Behind Corporate proxy"
echo $STATUS

I have solved it this way :

export http_proxy=''

wget -q --proxy-user=test --proxy-password=test --spider $URL
if [ $? = 1 ]
    STATUS= echo "Proxy isn't working"

  STATUS="Proxy is working."
echo $STATUS

Working? Well, you have to use them to see if they are working.

If you want to see if they are online, I guess ping is a first step.

There is a Ping class in .NET.

using System.Net.NetworkInformation;

private static bool CanPing(string address)
    Ping ping = new Ping();

        PingReply reply = ping.Send(address, 2000);
        if (reply == null) return false;

        return (reply.Status == IPStatus.Success);
    catch (PingException e)
        return false;

I like to do a WhatIsMyIP check through a proxy as a test.

public static void TestProxies() {
  var lowp = new List<WebProxy> { new WebProxy("", 8080), new WebProxy("", 80) };

  Parallel.ForEach(lowp, wp => {
    var success = false;
    var errorMsg = "";
    var sw = new Stopwatch();
    try {
      var response = new RestClient {
        BaseUrl = "",
        Proxy = wp
      }.Execute(new RestRequest {
        Resource = "api/ip",
        Method = Method.GET,
        Timeout = 10000,
        RequestFormat = DataFormat.Json
      if (response.ErrorException != null) {
        throw response.ErrorException;
      success = (response.Content == wp.Address.Host);
    } catch (Exception ex) {
      errorMsg = ex.Message;
    } finally {
      Console.WriteLine("Success:" + success.ToString() + "|Connection Time:" + sw.Elapsed.TotalSeconds + "|ErrorMsg" + errorMsg);

However, I might suggest testing explicitly for different types (ie http, https, socks4, socks5). The above only checks https. In building the ProxyChecker for, I started w/ the code above, then eventually had to expand for other capabilities/types.

try this:

public static bool SoketConnect(string host, int port)
    var is_success = false;
        var connsock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        connsock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 200);
        var hip = IPAddress.Parse(host);
        var ipep = new IPEndPoint(hip, port);
        if (connsock.Connected)
            is_success = true;
    catch (Exception)
        is_success = false;
    return is_success;
string strIP = "";
int intPort = 12345;

  public static bool PingHost(string strIP , int intPort )
        bool blProxy= false;
            TcpClient client = new TcpClient(strIP ,intPort );

            blProxy = true;
        catch (Exception ex)
            MessageBox.Show("Error pinging host:'" + strIP + ":" + intPort .ToString() + "'");
            return false;
        return blProxy;

    public void Proxy()
        bool tt = PingHost(strIP ,intPort );
        if(tt == true)
            MessageBox.Show("tt True");
            MessageBox.Show("tt False");



By: adityagauravkc Verified Staff Member Active community member
Simple man, evolving every jiffy.

Get involved!

No comments yet
News feed
Share to...