= srv: network name and address translation when hosted include "srv.m" srv := load Srv Srv->PATH; Srv: module { init: fn(); iph2a: fn(host: string): list of string; ipa2h: fn(addr: string): list of string; ipn2p: fn(protocol, service: string): string; };Srv provides access to the host operating system's name andaddress translation when Inferno is running hosted. The mod‐ule's implementation is usually built-in to emu(1), and thenonly on some platforms. It uses the Internet name resolutionservices of the host operating system (eg, gethostbyname onUnix systems). Its services are normally only used inter‐nally by cs(8) and dns(8), and even they give priority todata in services(6) and dns(6) if available. Other Infernoapplications normally give network addresses to the functionsof dial(2), and they are then translated automatically, usingthe services of cs(8).Init must be called before any other function is used.Given a host name, iph2a returns a list of its Internetaddresses (if any). Given an Internet address, ipa2h returnsa list of host names (if any) that have that address. Theresults are only as accurate as the host system's name ser‐vice.Ipn2p returns the port number (as a string) for the givenservice when accessed using a particular protocol protocol(typically tcp or udp).== source/emu/port/srv.c== see ALSOsys-file2chan(2), cs(8), dns(8)
= srv: network name and address translation when hosted
include "srv.m"
srv := load Srv Srv->PATH;
Srv: module
{
init: fn();
iph2a: fn(host: string): list of string;
ipa2h: fn(addr: string): list of string;
ipn2p: fn(protocol, service: string): string;
};
Srv provides access to the host operating system's name and
address translation when Inferno is running hosted. The mod‐
ule's implementation is usually built-in to emu(1), and then
only on some platforms. It uses the Internet name resolution
services of the host operating system (eg, gethostbyname on
Unix systems). Its services are normally only used inter‐
nally by cs(8) and dns(8), and even they give priority to
data in services(6) and dns(6) if available. Other Inferno
applications normally give network addresses to the functions
of dial(2), and they are then translated automatically, using
the services of cs(8).
Init must be called before any other function is used.
Given a host name, iph2a returns a list of its Internet
addresses (if any). Given an Internet address, ipa2h returns
a list of host names (if any) that have that address. The
results are only as accurate as the host system's name ser‐
vice.
Ipn2p returns the port number (as a string) for the given
service when accessed using a particular protocol protocol
(typically tcp or udp).
== source
/emu/port/srv.c
== see ALSO
sys-file2chan(2), cs(8), dns(8)