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; }Example:
int portNumber = 507; MessageBox.Show(portNumber.CheckOpenedPort().ToString());
Description
بررسی باز بودن پورت
Details
- Author: Mohammad Vafaei
- Submitted on: 2/12/2018 9:30:35 AM
- Language: C#
- Type: Extension Method Check Opened Port
- Views: 381
Double click on the code to select all.