Sockets - Maple Programming Help

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

Sockets

 HostInfo
 retrieve platform specific host information

 Calling Sequence HostInfo( key::symbol )::anything

Parameters

 key - recognized symbol identifying the requested information

Description

 • It is often necessary to retrieve platform specific data about the host on which your Sockets package code is running. The procedure HostInfo provides a simple interface through which you can request this kind of information.
 • A single symbol called the key is a required argument. The key is a mnemonic identifier for the specific information requested. An unrecognized key, or a call with a recognized key for which the information requested is not available results in an appropriate error message.
 • The recognized keys vary according to platform, but the following keys are recognized on all platforms: platform, os, hostname, domainname, and pid.
 • Platform specific keys generally exist only for testing purposes, are subject to change, and are not documented. For example, the key glibc is recognized only on Linux platforms (and reflects the compile-time glibc library version number.

Examples

 > $\mathrm{with}\left(\mathrm{Sockets}\right):$
 > $\mathrm{HostInfo}\left('\mathrm{platform}'\right)$
 ${"unix"}$ (1)
 > $\mathrm{HostInfo}\left('\mathrm{os}'\right)$
 ${"Linux"}$ (2)
 > $\mathrm{HostInfo}\left('\mathrm{pid}'\right)$
 ${31870}$ (3)
 > $\mathrm{HostInfo}\left('\mathrm{domainname}'\right)$
 ${"\left(none\right)"}$ (4)

If an unrecognized key is used, Maple returns an error.

 > $\mathrm{HostInfo}\left('\mathrm{NoSuchKey}'\right)$

If a key is not relevant in a platform, for example, domainname in a single user Windows version, Maple returns an error.

 > $\mathrm{HostInfo}\left('\mathrm{domainname}'\right)$