Sockets - Maple Programming Help

Home : Support : Online Help : Connectivity : Web Features : Network Communication : Sockets Package : Sockets/Address

Sockets

 perform hostname to IP address mappings

Parameters

 who - Maple string; contains a symbolic hostname or an IP address in base 256 notation

Description

 • The procedure Address can be used to map symbolic, human-readable hostnames to numeric IP addresses written in "dotted quad" or "base 256" notation. In all cases, the argument who must be of type string.
 • Given a symbolic hostname, such as www.maplesoft.com, Address returns its numeric IP address in base 256 notation in the form of a string. This is a sequence of four numbers, each between 0 and 255, and separated by dots that represents the internet address of the named host. The details of IP number structure and special case assignments are specified in RFC 1700 Assigned Numbers.
 • Conversely, given a numeric IP address in base 256 notation, such as $192.139\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}233.26$, Address returns a symbolic, human-readable hostname in the form of a string. Since a given node on a network may have multiple hostnames, it is the "canonical" hostname that is returned. (Thus, Address is not quite an involution.)

Examples

 > $\mathrm{with}\left(\mathrm{Sockets}\right):$
 > $\mathrm{Address}\left("www.maplesoft.com"\right)$
 ${"10.102.2.2"}$ (1)
 > $\mathrm{Address}\left("127.0.0.1"\right)$
 ${"localhost"}$ (2)
 > $\mathrm{Address}\left("10.10.10.169"\right)$
 ${"rdsomantis.maplesoft.com"}$ (3)
 > $\mathrm{Address}\left("localhost"\right)$
 ${"127.0.0.1"}$ (4)
 > $\mathrm{Address}\left("world.std.com"\right)$
 ${"192.74.137.5"}$ (5)

Get the canonical hostname from any given hostname by applying Address to its own output.

 > $\mathrm{Address}\left(\mathrm{Address}\left("www.w3c.org"\right)\right)$
 ${"dolph.w3.org"}$ (6)

References

 Information Sciences Institute, "RFC 1700 Assigned Numbers," ISI Home Page, http://www.isi.edu/in-notes/rfc1700.txt; accessed 17 November 2005.