开发者

What is the meaning of the Port Number parameter in Window's ATL Winsock wrapper CSocketAddr::FindINET4Addr

Is it the UDP port used to send out the DNS request, e.g. 53? Or can a host name like example.com have a different IP address resolution based off the specific port being used, e.g. example.com port 80 is 1.2.3.4 but example.com port 25 is 5.6.7.8? If so, then is this "port number" parameter the port specific name resolution?

This method eventually calls window's getaddrinfo where it ends up being the 2nd parameter const char* servname which is a string that is this integer port number as a stri开发者_开发问答ng, e.g. "53" or "80".


The port number is used when the flag parameter contains the AI_NUMERICSERV flag:

From http://msdn.microsoft.com/en-us/library/ms738520.aspx:

When the AI_NUMERICSERV bit is set, the pServiceName parameter must contain a non-NULL numeric port number, otherwise the EAI_NONAME error is returned. This flag prevents a name resolution service from being called.

The AI_NUMERICSERV flag is defined on Windows SDK for Windows Vista and later. The AI_NUMERICSERV flag is not supported by Microsoft providers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜