Valid characters of a hostname?

前端 未结 4 2220
南方客
南方客 2020-12-05 01:50

What are the valid characters of a hostname? This would be something like a networked computer or a web domain.

To put it in context, I am writing a PC game which co

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 02:07

    Checkout this wiki, specifically the section Restrictions on valid host names

    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.

提交回复
热议问题