CSocketWrench::GetServiceName Method  
 
BOOL GetServiceName(
  UINT nServicePort,  
  LPTSTR lpszServiceName,  
  INT nMaxLength  
);
BOOL GetServiceName(
  UINT nServicePort,  
  CString& strServiceName  
);

The GetServiceName method returns the service name associated with a specified port number.

Parameters

nServicePort
Port number associated with some network service.
lpszServiceName
A pointer to a string buffer that will contain the service name when the method returns. This may also reference a CString object that will contain the service name.
nMaxLength
An integer value which specifies the maximum number of characters that can be copied into the string buffer.

Return Value

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

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header: Include cswsock10.h
Import Library: cswskv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetServicePort