API Reference
Class
PortTester
Provides methods for testing TCP and UDP ports.
Inheritance
- Object
- PortTester
Constructors
public PortTester() #Methods
public IReadOnlyList<PortTestResult> TestServer(String computerName, IEnumerable<Int32> portTcp = null, IEnumerable<Int32> portUdp = null, Int32 retryCount = 1, Int32 retryDelayMs = 100, Int32 timeoutMs = 1000, Boolean udpRequireResponse = false, Byte[] udpPayload = null, CancellationToken cancellationToken = null) #Returns:
IReadOnlyList<PortTestResult>Tests ports on a single computer.
Parameters
- computerName System.String
- Target computer name or IP.
- portTcp System.Collections.Generic.IEnumerable{System.Int32} = null
- Collection of TCP ports to test.
- portUdp System.Collections.Generic.IEnumerable{System.Int32} = null
- Collection of UDP ports to test.
- retryCount System.Int32 = 1
- Number of retry attempts per port.
- retryDelayMs System.Int32 = 100
- Delay between retries in milliseconds.
- timeoutMs System.Int32 = 1000
- Connection timeout in milliseconds.
- udpRequireResponse System.Boolean = false
- When true, UDP tests expect a response which may fail for services that do not reply.
- udpPayload System.Byte[] = null
- Optional payload sent during UDP tests. If , an empty datagram is used.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Exceptions
ArgumentException– Thrown when udpPayload exceeds 65507 bytes.
public async Task<IReadOnlyList<PortTestResult>> TestServerAsync(String computerName, IEnumerable<Int32> portTcp = null, IEnumerable<Int32> portUdp = null, Int32 retryCount = 1, Int32 retryDelayMs = 100, Int32 timeoutMs = 1000, Boolean udpRequireResponse = false, Byte[] udpPayload = null, CancellationToken cancellationToken = null) #Returns:
Task<IReadOnlyList<PortTestResult>>Tests ports on a single computer.
Parameters
- computerName System.String
- Target computer name or IP.
- portTcp System.Collections.Generic.IEnumerable{System.Int32} = null
- Collection of TCP ports to test.
- portUdp System.Collections.Generic.IEnumerable{System.Int32} = null
- Collection of UDP ports to test.
- retryCount System.Int32 = 1
- Number of retry attempts per port.
- retryDelayMs System.Int32 = 100
- Delay between retries in milliseconds.
- timeoutMs System.Int32 = 1000
- Connection timeout in milliseconds.
- udpRequireResponse System.Boolean = false
- When true, UDP tests expect a response which may fail for services that do not reply.
- udpPayload System.Byte[] = null
- Optional payload sent during UDP tests. If , an empty datagram is used.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Exceptions
ArgumentException– Thrown when udpPayload exceeds 65507 bytes.