CWhoisClient::Connect Method  
 
BOOL Connect(
  LPCTSTR lpszRemoteHost,  
  UINT nRemotePort,  
  UINT nTimeout  
);

The Connect method establishes a connection with the specified server.

Parameters

lpszRemoteHost
The name of the server to connect to; this may be a fully-qualified domain name or an IP address.
nRemotePort
The port number the server is listening on; a value of zero specifies that the default port number should be used. For standard connections, the default port number is 43.
nTimeout
The number of seconds that the client will wait for a response from the server before failing the current operation.

Return Value

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

Remarks

This method will block the current thread until a connection has been established or the timeout period has elapsed. To prevent it from blocking the main user interface thread, the application should create a background worker thread and establish a connection by calling the Connect method in that thread. If the application requires multiple simultaneous connections, it is recommended you create a worker thread for each connection.

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

Disconnect, RegisterEvent