Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test if a proxy server is working or not?

Tags:

c#

proxy

I've got a pretty big list with proxy servers and their corresponding ports. How can I check, if they are working or not?

like image 383
Kris Avatar asked May 20 '10 15:05

Kris


Video Answer


1 Answers

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();

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

        return (reply.Status == IPStatus.Success);
    }
    catch (PingException e)
    {
        return false;
    }
}
like image 193
mafu Avatar answered Sep 28 '22 06:09

mafu