gpt4 book ai didi

networking - 主机名的有效字符?

转载 作者:行者123 更新时间:2023-12-03 05:20:42 25 4
gpt4 key购买 nike

主机名的有效字符是什么?这类似于联网计算机或网络域。

为了说明这一点,我正在编写一个连接到远程服务器的 PC 游戏;所以我有一个主机名字段和一个端口字段。显然,端口是短范围内的数字,但我需要知道所有可能的主机名字符是什么(以及可能需要的任何其他模式 - 主机名是否需要以字母开头?)。

主机名的示例包括 localhostgoogle.com

最佳答案

看看这个 wiki ,特别是有效主机名的限制

部分

Hostnames are composed of series of labels concatenated with dots, as are all domain names. For example, "en.wikipedia.org" is a hostname. Each label must be between 1 and 63 characters long, and the entire hostname (including the delimiting dots but not a trailing dot) has a maximum of 253 ASCII characters.

The Internet standards (Requests for Comments) for protocols mandate that component hostname labels may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted.

关于networking - 主机名的有效字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3523028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com