CWhoisClient::Search Method  
 
INT Search(
  LPCTSTR lpszKeyword,  
  UINT nSearchType  
);

The Search method submits the specified keyword to the server.

Parameters

lpszKeyword
Points to a string which specifies the query keyword. It may be a handle, name or mailbox.
nSearchType
The type of search being performed. One of the following values may be used:
Value Description
WHOIS_SEARCH_ANY Search for any record that matches the specified keyword.
WHOIS_SEARCH_HANDLE Search only for handles that match the specified keyword.
WHOIS_SEARCH_MAILBOX Search only for mailboxes that match the specified keyword.

Return Value

If the method succeeds, the return value is zero. If the method fails, the return value is WHOIS_ERROR. To get extended error information, call GetLastError.

Example

CWhoisClient whoisClient;

// Connect to the WHOIS server at whois.internic.net
if (whoisClient.Connect(_T("whois.internic.net")) == FALSE)
{
    whoisClient.ShowError();
    return;
}

// Request information about the sockettools.com domain name
if (whoisClient.Search(_T("sockettools.com")) == WHOIS_ERROR)
{
    whoisClient.ShowError();
    whoisClient.Disconnect();
    return;
}

// Read the response from the server, which contains information
// about the domain and the registry that maintains the record
CString strResult;
CString strBuffer;
INT nResult;

do
{
    if ((nResult = whoisClient.Read(strBuffer)) > 0)
        strResult += strBuffer;
}
while (nResult > 0);

// If there was an error reading the data, alert the user
if (nResult == WHOIS_ERROR)
    whoisClient.ShowError();

whoisClient.Disconnect();

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cswhov11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

Connect, Disconnect, IsReadable, Read