SocketTools .NET Edition

DnsClient.MatchHost Method (String, String)

Match a host name against one more strings that may contain wildcards.

[Visual Basic]
Overloads Public Function MatchHost( _
   ByVal hostName As String, _
   ByVal hostMask As String _
) As Boolean
[C#]
public bool MatchHost(
   string hostName,
   string hostMask
);

Parameters

hostName
A string which specifies the host name or Internet address to match against the host mask string.
hostMask
A string which specifies one or more values to match against the host name. The asterisk character can be used to match any number of characters in the host name, and the question mark can be used to match any single character. Multiple values may be specified by separating them with a semicolon.

Return Value

A boolean value which specifies if the method was successful or not. A return value of True indicates that the method call completed successfully. A return value of False indicates that the method failed and the application should check the value of the LastError property.

Remarks

The MatchHost method provides a convenient way for an application to determine if a given host name matches one or more mask strings which may contain wildcard characters. For example, the host name could be "www.microsoft.com" and the host mask string could be "*.microsoft.com". In this example, the function would return True, indicating the host name matched the mask. However, if the mask string was "*.net" then the function would return False, indicating that there was no match. Multiple mask values can be combined by separating them with a semicolon; for example, the mask "*.com;*.org" would match any host name in either the .com or .org top-level domains.

See Also

DnsClient Class | SocketTools Namespace | DnsClient.MatchHost Overload List