晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/opt/alt/ruby18/share/ri/1.8/system/TCPSocket/ |
| Current File : //opt/alt/ruby18/share/ri/1.8/system/TCPSocket/gethostbyname-c.yaml |
--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: Resolve <tt>host</tt> and return name and address information for it, similarly to gethostbyname(3). <tt>host</tt> can be a domain name or the presentation format of an address.
- !ruby/struct:SM::Flow::P
body: "Returns an array of information similar to that found in a +struct hostent+:"
- !ruby/struct:SM::Flow::VERB
body: " - cannonical name: the cannonical name for host in the DNS, or a\n string representing the address\n - aliases: an array of aliases for the canonical name, there may be no aliases\n - address family: usually one of Socket::AF_INET or Socket::AF_INET6\n - address: a string, the binary value of the +struct sockaddr+ for this name, in\n the indicated address family\n - ...: if there are multiple addresses for this host, a series of\n strings/+struct sockaddr+s may follow, not all necessarily in the same\n address family. Note that the fact that they may not be all in the same\n address family is a departure from the behaviour of gethostbyname(3).\n"
- !ruby/struct:SM::Flow::P
body: "Note: I believe that the fact that the multiple addresses returned are not necessarily in the same address family may be a bug, since if this function actually called gethostbyname(3), ALL the addresses returned in the trailing address list (h_addr_list from struct hostent) would be of the same address family! Examples from my system, OS X 10.3:"
- !ruby/struct:SM::Flow::VERB
body: " ["localhost", [], 30, "\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001", "\\177\\000\\000\\001"]\n and\n ["ensemble.local", [], 30, "\\376\\200\\000\\004\\000\\000\\000\\000\\002\\003\\223\\377\\376\\255\\010\\214", "\\300\\250{\\232" ]\n"
- !ruby/struct:SM::Flow::P
body: "Similar information can be returned by Socket.getaddrinfo if called as:"
- !ruby/struct:SM::Flow::VERB
body: " Socket.getaddrinfo(<tt>host</tt>, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)\n"
- !ruby/struct:SM::Flow::H
level: 2
text: Examples
- !ruby/struct:SM::Flow::VERB
body: " Socket.gethostbyname "example.com"\n => ["example.com", [], 2, "\\300\\000\\"\\246"]\n"
- !ruby/struct:SM::Flow::P
body: This name has no DNS aliases, and a single IPv4 address.
- !ruby/struct:SM::Flow::VERB
body: " Socket.gethostbyname "smtp.telus.net"\n => ["smtp.svc.telus.net", ["smtp.telus.net"], 2, "\\307\\271\\334\\371"]\n"
- !ruby/struct:SM::Flow::P
body: This name is an an alias so the canonical name is returned, as well as the alias and a single IPv4 address.
- !ruby/struct:SM::Flow::VERB
body: " Socket.gethostbyname "localhost"\n => ["localhost", [], 30, "\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\001", "\\177\\000\\000\\001"]\n"
- !ruby/struct:SM::Flow::P
body: This machine has no aliases, returns an IPv6 address, and has an additional IPv4 address.
- !ruby/struct:SM::Flow::P
body: "<tt>host</tt> can also be an IP address in presentation format, in which case a reverse lookup is done on the address:"
- !ruby/struct:SM::Flow::VERB
body: " Socket.gethostbyname("127.0.0.1")\n => ["localhost", [], 2, "\\177\\000\\000\\001"]\n\n Socket.gethostbyname("192.0.34.166")\n => ["www.example.com", [], 2, "\\300\\000\\"\\246"]\n"
- !ruby/struct:SM::Flow::H
level: 2
text: See
- !ruby/struct:SM::Flow::P
body: "See: Socket.getaddrinfo"
full_name: TCPSocket::gethostbyname
is_singleton: true
name: gethostbyname
params: " Socket.gethostbyname(host) => hostent\n"
visibility: public
|