aboutsummaryrefslogblamecommitdiffstats
path: root/lib/kernel/doc/src/net_adm.xml
blob: 4ef9d361f65a76e24196f2fd9a49e8306a12c8c1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                       




                                     
                                        


                                                        










                                                                              















                                                                           
                                           
                                                  
            

                                                                              



                             
                                        
                                                            


                                                                   

                                                                                    


             
                                        
                                                 

                                                                    
                                                                              



                                       

                                    
                                                          

                                                             
                                                                                    


                                                                      
                      





                                             
                                   
                                                        
            
                                                                            



                                                                          

                                    
                                                                                               
                              





                                                                      

                                                                                           








                                                                       

                                         
                                                                             
                              
























                                                                       
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>net_adm</title>
    <prepared>Claes Wikstrom</prepared>
    <docno>1</docno>
    <date>96-09-10</date>
    <rev>A</rev>
  </header>
  <module>net_adm</module>
  <modulesummary>Various Erlang Net Administration Routines</modulesummary>
  <description>
    <p>This module contains various network utility functions.</p>
  </description>
  <funcs>
    <func>
      <name name="dns_hostname" arity="1"/>
      <fsummary>Official name of a host</fsummary>
      <desc>
        <p>Returns the official name of <c><anno>Host</anno></c>, or
          <c>{error, <anno>Host</anno>}</c> if no such name is found. See also
          <c>inet(3)</c>.</p>
      </desc>
    </func>
    <func>
      <name name="host_file" arity="0"/>
      <fsummary>Read the <c>.hosts.erlang</c>file</fsummary>
      <desc>
        <p>Reads the <c>.hosts.erlang</c> file, see the section
          <em>Files</em> below. Returns the hosts in this file as a
          list, or returns <c>{error, <anno>Reason</anno>}</c> if the file could not
          be read or the Erlang terms on the file could not be interpreted.</p>
      </desc>
    </func>
    <func>
      <name name="localhost" arity="0"/>
      <fsummary>Name of the local host</fsummary>
      <desc>
        <p>Returns the name of the local host. If Erlang was started
          with the <c>-name</c> command line flag, <c><anno>Name</anno></c> is
          the fully qualified name.</p>
      </desc>
    </func>
    <func>
      <name name="names" arity="0"/>
      <name name="names" arity="1"/>
      <fsummary>Names of Erlang nodes at a host</fsummary>
      <desc>
        <p>Similar to <c>epmd -names</c>, see <c>epmd(1)</c>.
          <c><anno>Host</anno></c> defaults to the local host. Returns the names and
          associated port numbers of the Erlang nodes that <c>epmd</c>
          at the specified host has registered.</p>
        <p>Returns <c>{error, address}</c> if <c>epmd</c> is not
          running.</p>
        <pre>
(arne@dunn)1> <input>net_adm:names().</input>
{ok,[{"arne",40262}]}</pre>
      </desc>
    </func>
    <func>
      <name name="ping" arity="1"/>
      <fsummary>Set up a connection to a node</fsummary>
      <desc>
        <p>Tries to set up a connection to <c><anno>Node</anno></c>. Returns
          <c>pang</c> if it fails, or <c>pong</c> if it is successful.</p>
      </desc>
    </func>
    <func>
      <name name="world" arity="0"/>
      <name name="world" arity="1"/>
      <fsummary>Lookup and connect to all nodes at all hosts in <c>.hosts.erlang</c></fsummary>
      <type name="verbosity"/>
      <desc>
        <p>This function calls <c>names(Host)</c> for all hosts which
          are specified in the Erlang host file <c>.hosts.erlang</c>,
          collects the replies and then evaluates <c>ping(Node)</c> on
          all those nodes. Returns the list of all nodes that were,
	  successfully pinged.</p>
        <p><c><anno>Arg</anno></c> defaults to <c>silent</c>.
	 If <c><anno>Arg</anno> == verbose</c>, the function writes information about which
          nodes it is pinging to stdout.</p>
        <p>This function can be useful when a node is started, and
          the names of the other nodes in the network are not initially
          known.</p>
        <p>Failure: <c>{error, Reason}</c> if <c>host_file()</c>
          returns <c>{error, Reason}</c>.</p>
      </desc>
    </func>
    <func>
      <name name="world_list" arity="1"/>
      <name name="world_list" arity="2"/>
      <fsummary>Lookup and connect to all nodes at specified hosts</fsummary>
      <type name="verbosity"/>
      <desc>
        <p>As <c>world/0,1</c>, but the hosts are given as argument
          instead of being read from <c>.hosts.erlang</c>.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>Files</title>
    <p>The <c>.hosts.erlang</c> file consists of a number of host names
      written as Erlang terms. It is looked for in the current work
      directory, the user's home directory, and <c>$OTP_ROOT</c>
      (the root directory of Erlang/OTP), in that order.</p>
    <p>The format of the <c>.hosts.erlang</c> file must be one host
      name per line. The host names must be within quotes as shown in
      the following example:</p>
    <pre>
'super.eua.ericsson.se'.
'renat.eua.ericsson.se'.
'grouse.eua.ericsson.se'.
'gauffin1.eua.ericsson.se'.
^ (new line)</pre>
  </section>
</erlref>