ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods

Check Opened Port

بررسی باز بودن پورت


public static bool CheckOpenedPort(this int port)
    IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
    IPEndPoint[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpListeners();

    foreach (IPEndPoint endpoint in tcpConnInfoArray)
        if (endpoint.Port == port)
            return true;
    return false;


int portNumber = 507;

Author: Mohammad Vafaei

Submitted on: 12 feb 2018

Language: C#

Type: Extension Method Check Opened Port

Views: 3803