NetHostDB
structure
signature NET_HOST_DB
(* OPTIONAL *)
structure NetHostDB
:> NET_HOST_DB (* OPTIONAL *)
This structure accesses the information contained in the network host data base. The data might be retrieved from a file such as /etc/hosts
on Unix systems, or dynamically via some network communication. The structure can be used to convert host names (e.g., "cs.princeton.edu"
) to Internet addresses (e.g., "128.112.136.10"
).
eqtype in_addr
eqtype addr_family
type entry
val name : entry -> string
val aliases : entry -> string list
val addrType : entry -> addr_family
val addr : entry -> in_addr
val addrs : entry -> in_addr list
val getByName : string -> entry option
val getByAddr : in_addr -> entry option
val getHostName : unit -> string
val toString : in_addr -> string
val scan : (char, 'a) StringCvt.reader
-> (in_addr, 'a) StringCvt.reader
val fromString : string -> in_addr option
eqtype in_addr
eqtype addr_family
type entry
name en
aliases en
addrType en
addr en
addrs
.
addrs en
getByName s
SOME
(en)
where en
is the corresponding data base entry; otherwise, it returns NONE
.
getByAddr ia
SOME
(en)
where en
is the corresponding data base entry; otherwise, it returns NONE
.
val getHostName : unit -> string
toString ia
scan getc strm
fromString s
SOME
(ia,rest)
if an Internet address can be parsed from a prefix of the character stream strm after skipping initial whitespace. ia
is the resulting address, and rest
is the remainder of the character stream. NONE
is returned otherwise.
The second form returns
if an Internet address SOME
(ia)ia
can be parsed from a prefix of string s. NONE
is returned otherwise. It is equivalent to StringCvt.scanString scan
.
Addresses in this notation have one of the following forms:
GenericSock
,INetSock
,NetProtDB
,Socket
Generated October 02, 2003
Last Modified June 5, 1998
Comments to John Reppy.
This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.
Copyright © 2003 AT&T and Lucent Technologies. All rights reserved.
Permission is granted for internet users to make one paper copy for their
own personal use. Further hardcopy reproduction is strictly prohibited.
Permission to distribute the HTML document electronically on any medium
other than the internet must be requested from the copyright holders by
contacting the editors.
Printed versions of the SML Basis Manual are available from Cambridge
University Press.
To order, please visit
www.cup.org (North America) or
www.cup.cam.ac.uk (outside North America). |