Sophie

Sophie

distrib > Fedora > 17 > x86_64 > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 923

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- inet</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/kernel-2.15.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Kernel</strong><br><strong>Reference Manual</strong><br><small>Version 2.15.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li title="kernel (App)"><a href="kernel_app.html">kernel (App)
                </a></li>
<li id="no" title="application " expanded="false">application<ul>
<li><a href="application.html">
                  Top of manual page
                </a></li>
<li title="get_all_env-0"><a href="application.html#get_all_env-0">get_all_env/0</a></li>
<li title="get_all_env-1"><a href="application.html#get_all_env-1">get_all_env/1</a></li>
<li title="get_all_key-0"><a href="application.html#get_all_key-0">get_all_key/0</a></li>
<li title="get_all_key-1"><a href="application.html#get_all_key-1">get_all_key/1</a></li>
<li title="get_application-0"><a href="application.html#get_application-0">get_application/0</a></li>
<li title="get_application-1"><a href="application.html#get_application-1">get_application/1</a></li>
<li title="get_env-1"><a href="application.html#get_env-1">get_env/1</a></li>
<li title="get_env-2"><a href="application.html#get_env-2">get_env/2</a></li>
<li title="get_key-1"><a href="application.html#get_key-1">get_key/1</a></li>
<li title="get_key-2"><a href="application.html#get_key-2">get_key/2</a></li>
<li title="load-1"><a href="application.html#load-1">load/1</a></li>
<li title="load-2"><a href="application.html#load-2">load/2</a></li>
<li title="loaded_applications-0"><a href="application.html#loaded_applications-0">loaded_applications/0</a></li>
<li title="permit-2"><a href="application.html#permit-2">permit/2</a></li>
<li title="set_env-3"><a href="application.html#set_env-3">set_env/3</a></li>
<li title="set_env-4"><a href="application.html#set_env-4">set_env/4</a></li>
<li title="start-1"><a href="application.html#start-1">start/1</a></li>
<li title="start-2"><a href="application.html#start-2">start/2</a></li>
<li title="start_type-0"><a href="application.html#start_type-0">start_type/0</a></li>
<li title="stop-1"><a href="application.html#stop-1">stop/1</a></li>
<li title="takeover-2"><a href="application.html#takeover-2">takeover/2</a></li>
<li title="unload-1"><a href="application.html#unload-1">unload/1</a></li>
<li title="unset_env-2"><a href="application.html#unset_env-2">unset_env/2</a></li>
<li title="unset_env-3"><a href="application.html#unset_env-3">unset_env/3</a></li>
<li title="which_applications-0"><a href="application.html#which_applications-0">which_applications/0</a></li>
<li title="which_applications-1"><a href="application.html#which_applications-1">which_applications/1</a></li>
<li title="Module:start-2"><a href="application.html#Module:start-2">Module:start/2</a></li>
<li title="Module:start_phase-3"><a href="application.html#Module:start_phase-3">Module:start_phase/3</a></li>
<li title="Module:prep_stop-1"><a href="application.html#Module:prep_stop-1">Module:prep_stop/1</a></li>
<li title="Module:stop-1"><a href="application.html#Module:stop-1">Module:stop/1</a></li>
<li title="Module:config_change-3"><a href="application.html#Module:config_change-3">Module:config_change/3</a></li>
</ul>
</li>
<li id="no" title="auth " expanded="false">auth<ul>
<li><a href="auth.html">
                  Top of manual page
                </a></li>
<li title="is_auth-1"><a href="auth.html#is_auth-1">is_auth/1</a></li>
<li title="cookie-0"><a href="auth.html#cookie-0">cookie/0</a></li>
<li title="cookie-1"><a href="auth.html#cookie-1">cookie/1</a></li>
<li title="node_cookie-1"><a href="auth.html#node_cookie-1">node_cookie/1</a></li>
<li title="node_cookie-2"><a href="auth.html#node_cookie-2">node_cookie/2</a></li>
</ul>
</li>
<li id="no" title="code " expanded="false">code<ul>
<li><a href="code.html">
                  Top of manual page
                </a></li>
<li title="set_path-1"><a href="code.html#set_path-1">set_path/1</a></li>
<li title="get_path-0"><a href="code.html#get_path-0">get_path/0</a></li>
<li title="add_path-1"><a href="code.html#add_path-1">add_path/1</a></li>
<li title="add_pathz-1"><a href="code.html#add_pathz-1">add_pathz/1</a></li>
<li title="add_patha-1"><a href="code.html#add_patha-1">add_patha/1</a></li>
<li title="add_paths-1"><a href="code.html#add_paths-1">add_paths/1</a></li>
<li title="add_pathsz-1"><a href="code.html#add_pathsz-1">add_pathsz/1</a></li>
<li title="add_pathsa-1"><a href="code.html#add_pathsa-1">add_pathsa/1</a></li>
<li title="del_path-1"><a href="code.html#del_path-1">del_path/1</a></li>
<li title="replace_path-2"><a href="code.html#replace_path-2">replace_path/2</a></li>
<li title="load_file-1"><a href="code.html#load_file-1">load_file/1</a></li>
<li title="load_abs-1"><a href="code.html#load_abs-1">load_abs/1</a></li>
<li title="ensure_loaded-1"><a href="code.html#ensure_loaded-1">ensure_loaded/1</a></li>
<li title="load_binary-3"><a href="code.html#load_binary-3">load_binary/3</a></li>
<li title="delete-1"><a href="code.html#delete-1">delete/1</a></li>
<li title="purge-1"><a href="code.html#purge-1">purge/1</a></li>
<li title="soft_purge-1"><a href="code.html#soft_purge-1">soft_purge/1</a></li>
<li title="is_loaded-1"><a href="code.html#is_loaded-1">is_loaded/1</a></li>
<li title="all_loaded-0"><a href="code.html#all_loaded-0">all_loaded/0</a></li>
<li title="which-1"><a href="code.html#which-1">which/1</a></li>
<li title="get_object_code-1"><a href="code.html#get_object_code-1">get_object_code/1</a></li>
<li title="root_dir-0"><a href="code.html#root_dir-0">root_dir/0</a></li>
<li title="lib_dir-0"><a href="code.html#lib_dir-0">lib_dir/0</a></li>
<li title="lib_dir-1"><a href="code.html#lib_dir-1">lib_dir/1</a></li>
<li title="lib_dir-2"><a href="code.html#lib_dir-2">lib_dir/2</a></li>
<li title="compiler_dir-0"><a href="code.html#compiler_dir-0">compiler_dir/0</a></li>
<li title="priv_dir-1"><a href="code.html#priv_dir-1">priv_dir/1</a></li>
<li title="objfile_extension-0"><a href="code.html#objfile_extension-0">objfile_extension/0</a></li>
<li title="stick_dir-1"><a href="code.html#stick_dir-1">stick_dir/1</a></li>
<li title="unstick_dir-1"><a href="code.html#unstick_dir-1">unstick_dir/1</a></li>
<li title="is_sticky-1"><a href="code.html#is_sticky-1">is_sticky/1</a></li>
<li title="rehash-0"><a href="code.html#rehash-0">rehash/0</a></li>
<li title="where_is_file-1"><a href="code.html#where_is_file-1">where_is_file/1</a></li>
<li title="clash-0"><a href="code.html#clash-0">clash/0</a></li>
<li title="is_module_native-1"><a href="code.html#is_module_native-1">is_module_native/1</a></li>
</ul>
</li>
<li id="no" title="disk_log " expanded="false">disk_log<ul>
<li><a href="disk_log.html">
                  Top of manual page
                </a></li>
<li title="accessible_logs-0"><a href="disk_log.html#accessible_logs-0">accessible_logs/0</a></li>
<li title="alog-2"><a href="disk_log.html#alog-2">alog/2</a></li>
<li title="balog-2"><a href="disk_log.html#balog-2">balog/2</a></li>
<li title="alog_terms-2"><a href="disk_log.html#alog_terms-2">alog_terms/2</a></li>
<li title="balog_terms-2"><a href="disk_log.html#balog_terms-2">balog_terms/2</a></li>
<li title="block-1"><a href="disk_log.html#block-1">block/1</a></li>
<li title="block-2"><a href="disk_log.html#block-2">block/2</a></li>
<li title="change_header-2"><a href="disk_log.html#change_header-2">change_header/2</a></li>
<li title="change_notify-3"><a href="disk_log.html#change_notify-3">change_notify/3</a></li>
<li title="change_size-2"><a href="disk_log.html#change_size-2">change_size/2</a></li>
<li title="chunk-2"><a href="disk_log.html#chunk-2">chunk/2</a></li>
<li title="chunk-3"><a href="disk_log.html#chunk-3">chunk/3</a></li>
<li title="bchunk-2"><a href="disk_log.html#bchunk-2">bchunk/2</a></li>
<li title="bchunk-3"><a href="disk_log.html#bchunk-3">bchunk/3</a></li>
<li title="chunk_info-1"><a href="disk_log.html#chunk_info-1">chunk_info/1</a></li>
<li title="chunk_step-3"><a href="disk_log.html#chunk_step-3">chunk_step/3</a></li>
<li title="close-1"><a href="disk_log.html#close-1">close/1</a></li>
<li title="format_error-1"><a href="disk_log.html#format_error-1">format_error/1</a></li>
<li title="inc_wrap_file-1"><a href="disk_log.html#inc_wrap_file-1">inc_wrap_file/1</a></li>
<li title="info-1"><a href="disk_log.html#info-1">info/1</a></li>
<li title="lclose-1"><a href="disk_log.html#lclose-1">lclose/1</a></li>
<li title="lclose-2"><a href="disk_log.html#lclose-2">lclose/2</a></li>
<li title="log-2"><a href="disk_log.html#log-2">log/2</a></li>
<li title="blog-2"><a href="disk_log.html#blog-2">blog/2</a></li>
<li title="log_terms-2"><a href="disk_log.html#log_terms-2">log_terms/2</a></li>
<li title="blog_terms-2"><a href="disk_log.html#blog_terms-2">blog_terms/2</a></li>
<li title="open-1"><a href="disk_log.html#open-1">open/1</a></li>
<li title="pid2name-1"><a href="disk_log.html#pid2name-1">pid2name/1</a></li>
<li title="reopen-2"><a href="disk_log.html#reopen-2">reopen/2</a></li>
<li title="reopen-3"><a href="disk_log.html#reopen-3">reopen/3</a></li>
<li title="breopen-3"><a href="disk_log.html#breopen-3">breopen/3</a></li>
<li title="sync-1"><a href="disk_log.html#sync-1">sync/1</a></li>
<li title="truncate-1"><a href="disk_log.html#truncate-1">truncate/1</a></li>
<li title="truncate-2"><a href="disk_log.html#truncate-2">truncate/2</a></li>
<li title="btruncate-2"><a href="disk_log.html#btruncate-2">btruncate/2</a></li>
<li title="unblock-1"><a href="disk_log.html#unblock-1">unblock/1</a></li>
</ul>
</li>
<li id="no" title="erl_boot_server " expanded="false">erl_boot_server<ul>
<li><a href="erl_boot_server.html">
                  Top of manual page
                </a></li>
<li title="start-1"><a href="erl_boot_server.html#start-1">start/1</a></li>
<li title="start_link-1"><a href="erl_boot_server.html#start_link-1">start_link/1</a></li>
<li title="add_slave-1"><a href="erl_boot_server.html#add_slave-1">add_slave/1</a></li>
<li title="delete_slave-1"><a href="erl_boot_server.html#delete_slave-1">delete_slave/1</a></li>
<li title="which_slaves-0"><a href="erl_boot_server.html#which_slaves-0">which_slaves/0</a></li>
</ul>
</li>
<li id="no" title="erl_ddll " expanded="false">erl_ddll<ul>
<li><a href="erl_ddll.html">
                  Top of manual page
                </a></li>
<li title="demonitor-1"><a href="erl_ddll.html#demonitor-1">demonitor/1</a></li>
<li title="info-0"><a href="erl_ddll.html#info-0">info/0</a></li>
<li title="info-1"><a href="erl_ddll.html#info-1">info/1</a></li>
<li title="info-2"><a href="erl_ddll.html#info-2">info/2</a></li>
<li title="load-2"><a href="erl_ddll.html#load-2">load/2</a></li>
<li title="load_driver-2"><a href="erl_ddll.html#load_driver-2">load_driver/2</a></li>
<li title="monitor-2"><a href="erl_ddll.html#monitor-2">monitor/2</a></li>
<li title="reload-2"><a href="erl_ddll.html#reload-2">reload/2</a></li>
<li title="reload_driver-2"><a href="erl_ddll.html#reload_driver-2">reload_driver/2</a></li>
<li title="try_load-3"><a href="erl_ddll.html#try_load-3">try_load/3</a></li>
<li title="try_unload-2"><a href="erl_ddll.html#try_unload-2">try_unload/2</a></li>
<li title="unload-1"><a href="erl_ddll.html#unload-1">unload/1</a></li>
<li title="unload_driver-1"><a href="erl_ddll.html#unload_driver-1">unload_driver/1</a></li>
<li title="loaded_drivers-0"><a href="erl_ddll.html#loaded_drivers-0">loaded_drivers/0</a></li>
<li title="format_error-1"><a href="erl_ddll.html#format_error-1">format_error/1</a></li>
</ul>
</li>
<li title="erl_prim_loader"><a href="erl_prim_loader.html">erl_prim_loader</a></li>
<li title="erlang"><a href="erlang.html">erlang</a></li>
<li id="no" title="error_handler " expanded="false">error_handler<ul>
<li><a href="error_handler.html">
                  Top of manual page
                </a></li>
<li title="undefined_function-3"><a href="error_handler.html#undefined_function-3">undefined_function/3</a></li>
<li title="undefined_lambda-3"><a href="error_handler.html#undefined_lambda-3">undefined_lambda/3</a></li>
</ul>
</li>
<li id="no" title="error_logger " expanded="false">error_logger<ul>
<li><a href="error_logger.html">
                  Top of manual page
                </a></li>
<li title="error_msg-1"><a href="error_logger.html#error_msg-1">error_msg/1</a></li>
<li title="error_msg-2"><a href="error_logger.html#error_msg-2">error_msg/2</a></li>
<li title="format-2"><a href="error_logger.html#format-2">format/2</a></li>
<li title="error_report-1"><a href="error_logger.html#error_report-1">error_report/1</a></li>
<li title="error_report-2"><a href="error_logger.html#error_report-2">error_report/2</a></li>
<li title="warning_map-0"><a href="error_logger.html#warning_map-0">warning_map/0</a></li>
<li title="warning_msg-1"><a href="error_logger.html#warning_msg-1">warning_msg/1</a></li>
<li title="warning_msg-2"><a href="error_logger.html#warning_msg-2">warning_msg/2</a></li>
<li title="warning_report-1"><a href="error_logger.html#warning_report-1">warning_report/1</a></li>
<li title="warning_report-2"><a href="error_logger.html#warning_report-2">warning_report/2</a></li>
<li title="info_msg-1"><a href="error_logger.html#info_msg-1">info_msg/1</a></li>
<li title="info_msg-2"><a href="error_logger.html#info_msg-2">info_msg/2</a></li>
<li title="info_report-1"><a href="error_logger.html#info_report-1">info_report/1</a></li>
<li title="info_report-2"><a href="error_logger.html#info_report-2">info_report/2</a></li>
<li title="add_report_handler-1"><a href="error_logger.html#add_report_handler-1">add_report_handler/1</a></li>
<li title="add_report_handler-2"><a href="error_logger.html#add_report_handler-2">add_report_handler/2</a></li>
<li title="delete_report_handler-1"><a href="error_logger.html#delete_report_handler-1">delete_report_handler/1</a></li>
<li title="tty-1"><a href="error_logger.html#tty-1">tty/1</a></li>
<li title="logfile-1"><a href="error_logger.html#logfile-1">logfile/1</a></li>
</ul>
</li>
<li id="no" title="file " expanded="false">file<ul>
<li><a href="file.html">
                  Top of manual page
                </a></li>
<li title="advise-4"><a href="file.html#advise-4">advise/4</a></li>
<li title="change_group-2"><a href="file.html#change_group-2">change_group/2</a></li>
<li title="change_mode-2"><a href="file.html#change_mode-2">change_mode/2</a></li>
<li title="change_owner-2"><a href="file.html#change_owner-2">change_owner/2</a></li>
<li title="change_owner-3"><a href="file.html#change_owner-3">change_owner/3</a></li>
<li title="change_time-2"><a href="file.html#change_time-2">change_time/2</a></li>
<li title="change_time-3"><a href="file.html#change_time-3">change_time/3</a></li>
<li title="close-1"><a href="file.html#close-1">close/1</a></li>
<li title="consult-1"><a href="file.html#consult-1">consult/1</a></li>
<li title="copy-2"><a href="file.html#copy-2">copy/2</a></li>
<li title="copy-3"><a href="file.html#copy-3">copy/3</a></li>
<li title="del_dir-1"><a href="file.html#del_dir-1">del_dir/1</a></li>
<li title="delete-1"><a href="file.html#delete-1">delete/1</a></li>
<li title="eval-1"><a href="file.html#eval-1">eval/1</a></li>
<li title="eval-2"><a href="file.html#eval-2">eval/2</a></li>
<li title="file_info-1"><a href="file.html#file_info-1">file_info/1</a></li>
<li title="format_error-1"><a href="file.html#format_error-1">format_error/1</a></li>
<li title="get_cwd-0"><a href="file.html#get_cwd-0">get_cwd/0</a></li>
<li title="get_cwd-1"><a href="file.html#get_cwd-1">get_cwd/1</a></li>
<li title="list_dir-1"><a href="file.html#list_dir-1">list_dir/1</a></li>
<li title="make_dir-1"><a href="file.html#make_dir-1">make_dir/1</a></li>
<li title="make_link-2"><a href="file.html#make_link-2">make_link/2</a></li>
<li title="make_symlink-2"><a href="file.html#make_symlink-2">make_symlink/2</a></li>
<li title="native_name_encoding-0"><a href="file.html#native_name_encoding-0">native_name_encoding/0</a></li>
<li title="open-2"><a href="file.html#open-2">open/2</a></li>
<li title="path_consult-2"><a href="file.html#path_consult-2">path_consult/2</a></li>
<li title="path_eval-2"><a href="file.html#path_eval-2">path_eval/2</a></li>
<li title="path_open-3"><a href="file.html#path_open-3">path_open/3</a></li>
<li title="path_script-2"><a href="file.html#path_script-2">path_script/2</a></li>
<li title="path_script-3"><a href="file.html#path_script-3">path_script/3</a></li>
<li title="pid2name-1"><a href="file.html#pid2name-1">pid2name/1</a></li>
<li title="position-2"><a href="file.html#position-2">position/2</a></li>
<li title="pread-2"><a href="file.html#pread-2">pread/2</a></li>
<li title="pread-3"><a href="file.html#pread-3">pread/3</a></li>
<li title="pwrite-2"><a href="file.html#pwrite-2">pwrite/2</a></li>
<li title="pwrite-3"><a href="file.html#pwrite-3">pwrite/3</a></li>
<li title="read-2"><a href="file.html#read-2">read/2</a></li>
<li title="read_file-1"><a href="file.html#read_file-1">read_file/1</a></li>
<li title="read_file_info-1"><a href="file.html#read_file_info-1">read_file_info/1</a></li>
<li title="read_file_info-2"><a href="file.html#read_file_info-2">read_file_info/2</a></li>
<li title="read_line-1"><a href="file.html#read_line-1">read_line/1</a></li>
<li title="read_link-1"><a href="file.html#read_link-1">read_link/1</a></li>
<li title="read_link_info-1"><a href="file.html#read_link_info-1">read_link_info/1</a></li>
<li title="read_link_info-2"><a href="file.html#read_link_info-2">read_link_info/2</a></li>
<li title="rename-2"><a href="file.html#rename-2">rename/2</a></li>
<li title="script-1"><a href="file.html#script-1">script/1</a></li>
<li title="script-2"><a href="file.html#script-2">script/2</a></li>
<li title="set_cwd-1"><a href="file.html#set_cwd-1">set_cwd/1</a></li>
<li title="sync-1"><a href="file.html#sync-1">sync/1</a></li>
<li title="datasync-1"><a href="file.html#datasync-1">datasync/1</a></li>
<li title="truncate-1"><a href="file.html#truncate-1">truncate/1</a></li>
<li title="sendfile-2"><a href="file.html#sendfile-2">sendfile/2</a></li>
<li title="sendfile-5"><a href="file.html#sendfile-5">sendfile/5</a></li>
<li title="write-2"><a href="file.html#write-2">write/2</a></li>
<li title="write_file-2"><a href="file.html#write_file-2">write_file/2</a></li>
<li title="write_file-3"><a href="file.html#write_file-3">write_file/3</a></li>
<li title="write_file_info-2"><a href="file.html#write_file_info-2">write_file_info/2</a></li>
<li title="write_file_info-3"><a href="file.html#write_file_info-3">write_file_info/3</a></li>
</ul>
</li>
<li id="no" title="gen_tcp " expanded="false">gen_tcp<ul>
<li><a href="gen_tcp.html">
                  Top of manual page
                </a></li>
<li title="connect-3"><a href="gen_tcp.html#connect-3">connect/3</a></li>
<li title="connect-4"><a href="gen_tcp.html#connect-4">connect/4</a></li>
<li title="listen-2"><a href="gen_tcp.html#listen-2">listen/2</a></li>
<li title="accept-1"><a href="gen_tcp.html#accept-1">accept/1</a></li>
<li title="accept-2"><a href="gen_tcp.html#accept-2">accept/2</a></li>
<li title="send-2"><a href="gen_tcp.html#send-2">send/2</a></li>
<li title="recv-2"><a href="gen_tcp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_tcp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_tcp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_tcp.html#close-1">close/1</a></li>
<li title="shutdown-2"><a href="gen_tcp.html#shutdown-2">shutdown/2</a></li>
</ul>
</li>
<li id="no" title="gen_udp " expanded="false">gen_udp<ul>
<li><a href="gen_udp.html">
                  Top of manual page
                </a></li>
<li title="open-1"><a href="gen_udp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_udp.html#open-2">open/2</a></li>
<li title="send-4"><a href="gen_udp.html#send-4">send/4</a></li>
<li title="recv-2"><a href="gen_udp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="gen_udp.html#recv-3">recv/3</a></li>
<li title="controlling_process-2"><a href="gen_udp.html#controlling_process-2">controlling_process/2</a></li>
<li title="close-1"><a href="gen_udp.html#close-1">close/1</a></li>
</ul>
</li>
<li id="no" title="gen_sctp " expanded="false">gen_sctp<ul>
<li><a href="gen_sctp.html">
                  Top of manual page
                </a></li>
<li title="abort-2"><a href="gen_sctp.html#abort-2">abort/2</a></li>
<li title="close-1"><a href="gen_sctp.html#close-1">close/1</a></li>
<li title="connect-4"><a href="gen_sctp.html#connect-4">connect/4</a></li>
<li title="connect-5"><a href="gen_sctp.html#connect-5">connect/5</a></li>
<li title="connect_init-4"><a href="gen_sctp.html#connect_init-4">connect_init/4</a></li>
<li title="connect_init-5"><a href="gen_sctp.html#connect_init-5">connect_init/5</a></li>
<li title="controlling_process-2"><a href="gen_sctp.html#controlling_process-2">controlling_process/2</a></li>
<li title="eof-2"><a href="gen_sctp.html#eof-2">eof/2</a></li>
<li title="listen-2"><a href="gen_sctp.html#listen-2">listen/2</a></li>
<li title="open-0"><a href="gen_sctp.html#open-0">open/0</a></li>
<li title="open-1"><a href="gen_sctp.html#open-1">open/1</a></li>
<li title="open-2"><a href="gen_sctp.html#open-2">open/2</a></li>
<li title="peeloff-2"><a href="gen_sctp.html#peeloff-2">peeloff/2</a></li>
<li title="recv-1"><a href="gen_sctp.html#recv-1">recv/1</a></li>
<li title="recv-2"><a href="gen_sctp.html#recv-2">recv/2</a></li>
<li title="send-3"><a href="gen_sctp.html#send-3">send/3</a></li>
<li title="send-4"><a href="gen_sctp.html#send-4">send/4</a></li>
<li title="error_string-1"><a href="gen_sctp.html#error_string-1">error_string/1</a></li>
</ul>
</li>
<li id="no" title="global " expanded="false">global<ul>
<li><a href="global.html">
                  Top of manual page
                </a></li>
<li title="del_lock-1"><a href="global.html#del_lock-1">del_lock/1</a></li>
<li title="del_lock-2"><a href="global.html#del_lock-2">del_lock/2</a></li>
<li title="notify_all_name-3"><a href="global.html#notify_all_name-3">notify_all_name/3</a></li>
<li title="random_exit_name-3"><a href="global.html#random_exit_name-3">random_exit_name/3</a></li>
<li title="random_notify_name-3"><a href="global.html#random_notify_name-3">random_notify_name/3</a></li>
<li title="register_name-2"><a href="global.html#register_name-2">register_name/2</a></li>
<li title="register_name-3"><a href="global.html#register_name-3">register_name/3</a></li>
<li title="registered_names-0"><a href="global.html#registered_names-0">registered_names/0</a></li>
<li title="re_register_name-2"><a href="global.html#re_register_name-2">re_register_name/2</a></li>
<li title="re_register_name-3"><a href="global.html#re_register_name-3">re_register_name/3</a></li>
<li title="send-2"><a href="global.html#send-2">send/2</a></li>
<li title="set_lock-1"><a href="global.html#set_lock-1">set_lock/1</a></li>
<li title="set_lock-2"><a href="global.html#set_lock-2">set_lock/2</a></li>
<li title="set_lock-3"><a href="global.html#set_lock-3">set_lock/3</a></li>
<li title="sync-0"><a href="global.html#sync-0">sync/0</a></li>
<li title="trans-2"><a href="global.html#trans-2">trans/2</a></li>
<li title="trans-3"><a href="global.html#trans-3">trans/3</a></li>
<li title="trans-4"><a href="global.html#trans-4">trans/4</a></li>
<li title="unregister_name-1"><a href="global.html#unregister_name-1">unregister_name/1</a></li>
<li title="whereis_name-1"><a href="global.html#whereis_name-1">whereis_name/1</a></li>
</ul>
</li>
<li id="no" title="global_group " expanded="false">global_group<ul>
<li><a href="global_group.html">
                  Top of manual page
                </a></li>
<li title="global_groups-0"><a href="global_group.html#global_groups-0">global_groups/0</a></li>
<li title="info-0"><a href="global_group.html#info-0">info/0</a></li>
<li title="monitor_nodes-1"><a href="global_group.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="own_nodes-0"><a href="global_group.html#own_nodes-0">own_nodes/0</a></li>
<li title="registered_names-1"><a href="global_group.html#registered_names-1">registered_names/1</a></li>
<li title="send-2"><a href="global_group.html#send-2">send/2</a></li>
<li title="send-3"><a href="global_group.html#send-3">send/3</a></li>
<li title="sync-0"><a href="global_group.html#sync-0">sync/0</a></li>
<li title="whereis_name-1"><a href="global_group.html#whereis_name-1">whereis_name/1</a></li>
<li title="whereis_name-2"><a href="global_group.html#whereis_name-2">whereis_name/2</a></li>
</ul>
</li>
<li id="no" title="heart " expanded="false">heart<ul>
<li><a href="heart.html">
                  Top of manual page
                </a></li>
<li title="set_cmd-1"><a href="heart.html#set_cmd-1">set_cmd/1</a></li>
<li title="clear_cmd-0"><a href="heart.html#clear_cmd-0">clear_cmd/0</a></li>
<li title="get_cmd-0"><a href="heart.html#get_cmd-0">get_cmd/0</a></li>
</ul>
</li>
<li id="loadscrollpos" title="inet " expanded="true">inet<ul>
<li><a href="inet.html">
                  Top of manual page
                </a></li>
<li title="close-1"><a href="inet.html#close-1">close/1</a></li>
<li title="get_rc-0"><a href="inet.html#get_rc-0">get_rc/0</a></li>
<li title="format_error-1"><a href="inet.html#format_error-1">format_error/1</a></li>
<li title="getaddr-2"><a href="inet.html#getaddr-2">getaddr/2</a></li>
<li title="getaddrs-2"><a href="inet.html#getaddrs-2">getaddrs/2</a></li>
<li title="gethostbyaddr-1"><a href="inet.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyname-1"><a href="inet.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostname-0"><a href="inet.html#gethostname-0">gethostname/0</a></li>
<li title="getifaddrs-0"><a href="inet.html#getifaddrs-0">getifaddrs/0</a></li>
<li title="getopts-2"><a href="inet.html#getopts-2">getopts/2</a></li>
<li title="getstat-1"><a href="inet.html#getstat-1">getstat/1</a></li>
<li title="getstat-2"><a href="inet.html#getstat-2">getstat/2</a></li>
<li title="peername-1"><a href="inet.html#peername-1">peername/1</a></li>
<li title="port-1"><a href="inet.html#port-1">port/1</a></li>
<li title="sockname-1"><a href="inet.html#sockname-1">sockname/1</a></li>
<li title="setopts-2"><a href="inet.html#setopts-2">setopts/2</a></li>
</ul>
</li>
<li id="no" title="inet_res " expanded="false">inet_res<ul>
<li><a href="inet_res.html">
                  Top of manual page
                </a></li>
<li title="getbyname-2"><a href="inet_res.html#getbyname-2">getbyname/2</a></li>
<li title="getbyname-3"><a href="inet_res.html#getbyname-3">getbyname/3</a></li>
<li title="gethostbyaddr-1"><a href="inet_res.html#gethostbyaddr-1">gethostbyaddr/1</a></li>
<li title="gethostbyaddr-2"><a href="inet_res.html#gethostbyaddr-2">gethostbyaddr/2</a></li>
<li title="gethostbyname-1"><a href="inet_res.html#gethostbyname-1">gethostbyname/1</a></li>
<li title="gethostbyname-2"><a href="inet_res.html#gethostbyname-2">gethostbyname/2</a></li>
<li title="gethostbyname-3"><a href="inet_res.html#gethostbyname-3">gethostbyname/3</a></li>
<li title="lookup-3"><a href="inet_res.html#lookup-3">lookup/3</a></li>
<li title="lookup-4"><a href="inet_res.html#lookup-4">lookup/4</a></li>
<li title="lookup-5"><a href="inet_res.html#lookup-5">lookup/5</a></li>
<li title="resolve-3"><a href="inet_res.html#resolve-3">resolve/3</a></li>
<li title="resolve-4"><a href="inet_res.html#resolve-4">resolve/4</a></li>
<li title="resolve-5"><a href="inet_res.html#resolve-5">resolve/5</a></li>
<li title="nslookup-3"><a href="inet_res.html#nslookup-3">nslookup/3</a></li>
<li title="nslookup-4"><a href="inet_res.html#nslookup-4">nslookup/4</a></li>
<li title="nnslookup-4"><a href="inet_res.html#nnslookup-4">nnslookup/4</a></li>
<li title="nnslookup-5"><a href="inet_res.html#nnslookup-5">nnslookup/5</a></li>
</ul>
</li>
<li title="init"><a href="init.html">init</a></li>
<li id="no" title="net_adm " expanded="false">net_adm<ul>
<li><a href="net_adm.html">
                  Top of manual page
                </a></li>
<li title="dns_hostname-1"><a href="net_adm.html#dns_hostname-1">dns_hostname/1</a></li>
<li title="host_file-0"><a href="net_adm.html#host_file-0">host_file/0</a></li>
<li title="localhost-0"><a href="net_adm.html#localhost-0">localhost/0</a></li>
<li title="names-0"><a href="net_adm.html#names-0">names/0</a></li>
<li title="names-1"><a href="net_adm.html#names-1">names/1</a></li>
<li title="ping-1"><a href="net_adm.html#ping-1">ping/1</a></li>
<li title="world-0"><a href="net_adm.html#world-0">world/0</a></li>
<li title="world-1"><a href="net_adm.html#world-1">world/1</a></li>
<li title="world_list-1"><a href="net_adm.html#world_list-1">world_list/1</a></li>
<li title="world_list-2"><a href="net_adm.html#world_list-2">world_list/2</a></li>
</ul>
</li>
<li id="no" title="net_kernel " expanded="false">net_kernel<ul>
<li><a href="net_kernel.html">
                  Top of manual page
                </a></li>
<li title="allow-1"><a href="net_kernel.html#allow-1">allow/1</a></li>
<li title="connect_node-1"><a href="net_kernel.html#connect_node-1">connect_node/1</a></li>
<li title="monitor_nodes-1"><a href="net_kernel.html#monitor_nodes-1">monitor_nodes/1</a></li>
<li title="monitor_nodes-2"><a href="net_kernel.html#monitor_nodes-2">monitor_nodes/2</a></li>
<li title="get_net_ticktime-0"><a href="net_kernel.html#get_net_ticktime-0">get_net_ticktime/0</a></li>
<li title="set_net_ticktime-1"><a href="net_kernel.html#set_net_ticktime-1">set_net_ticktime/1</a></li>
<li title="set_net_ticktime-2"><a href="net_kernel.html#set_net_ticktime-2">set_net_ticktime/2</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li>
<li title="stop-0"><a href="net_kernel.html#stop-0">stop/0</a></li>
</ul>
</li>
<li id="no" title="os " expanded="false">os<ul>
<li><a href="os.html">
                  Top of manual page
                </a></li>
<li title="cmd-1"><a href="os.html#cmd-1">cmd/1</a></li>
<li title="find_executable-1"><a href="os.html#find_executable-1">find_executable/1</a></li>
<li title="find_executable-2"><a href="os.html#find_executable-2">find_executable/2</a></li>
<li title="getenv-0"><a href="os.html#getenv-0">getenv/0</a></li>
<li title="getenv-1"><a href="os.html#getenv-1">getenv/1</a></li>
<li title="getpid-0"><a href="os.html#getpid-0">getpid/0</a></li>
<li title="putenv-2"><a href="os.html#putenv-2">putenv/2</a></li>
<li title="timestamp-0"><a href="os.html#timestamp-0">timestamp/0</a></li>
<li title="type-0"><a href="os.html#type-0">type/0</a></li>
<li title="version-0"><a href="os.html#version-0">version/0</a></li>
</ul>
</li>
<li id="no" title="pg2 " expanded="false">pg2<ul>
<li><a href="pg2.html">
                  Top of manual page
                </a></li>
<li title="create-1"><a href="pg2.html#create-1">create/1</a></li>
<li title="delete-1"><a href="pg2.html#delete-1">delete/1</a></li>
<li title="get_closest_pid-1"><a href="pg2.html#get_closest_pid-1">get_closest_pid/1</a></li>
<li title="get_members-1"><a href="pg2.html#get_members-1">get_members/1</a></li>
<li title="get_local_members-1"><a href="pg2.html#get_local_members-1">get_local_members/1</a></li>
<li title="join-2"><a href="pg2.html#join-2">join/2</a></li>
<li title="leave-2"><a href="pg2.html#leave-2">leave/2</a></li>
<li title="which_groups-0"><a href="pg2.html#which_groups-0">which_groups/0</a></li>
<li title="start-0"><a href="pg2.html#start-0">start/0</a></li>
<li title="start_link-0"><a href="pg2.html#start_link-0">start_link/0</a></li>
</ul>
</li>
<li id="no" title="rpc " expanded="false">rpc<ul>
<li><a href="rpc.html">
                  Top of manual page
                </a></li>
<li title="call-4"><a href="rpc.html#call-4">call/4</a></li>
<li title="call-5"><a href="rpc.html#call-5">call/5</a></li>
<li title="block_call-4"><a href="rpc.html#block_call-4">block_call/4</a></li>
<li title="block_call-5"><a href="rpc.html#block_call-5">block_call/5</a></li>
<li title="async_call-4"><a href="rpc.html#async_call-4">async_call/4</a></li>
<li title="yield-1"><a href="rpc.html#yield-1">yield/1</a></li>
<li title="nb_yield-1"><a href="rpc.html#nb_yield-1">nb_yield/1</a></li>
<li title="nb_yield-2"><a href="rpc.html#nb_yield-2">nb_yield/2</a></li>
<li title="multicall-3"><a href="rpc.html#multicall-3">multicall/3</a></li>
<li title="multicall-4"><a href="rpc.html#multicall-4">multicall/4</a></li>
<li title="multicall-5"><a href="rpc.html#multicall-5">multicall/5</a></li>
<li title="cast-4"><a href="rpc.html#cast-4">cast/4</a></li>
<li title="eval_everywhere-3"><a href="rpc.html#eval_everywhere-3">eval_everywhere/3</a></li>
<li title="eval_everywhere-4"><a href="rpc.html#eval_everywhere-4">eval_everywhere/4</a></li>
<li title="abcast-2"><a href="rpc.html#abcast-2">abcast/2</a></li>
<li title="abcast-3"><a href="rpc.html#abcast-3">abcast/3</a></li>
<li title="sbcast-2"><a href="rpc.html#sbcast-2">sbcast/2</a></li>
<li title="sbcast-3"><a href="rpc.html#sbcast-3">sbcast/3</a></li>
<li title="server_call-4"><a href="rpc.html#server_call-4">server_call/4</a></li>
<li title="multi_server_call-2"><a href="rpc.html#multi_server_call-2">multi_server_call/2</a></li>
<li title="multi_server_call-3"><a href="rpc.html#multi_server_call-3">multi_server_call/3</a></li>
<li title="safe_multi_server_call-2"><a href="rpc.html#safe_multi_server_call-2">safe_multi_server_call/2</a></li>
<li title="safe_multi_server_call-3"><a href="rpc.html#safe_multi_server_call-3">safe_multi_server_call/3</a></li>
<li title="parallel_eval-1"><a href="rpc.html#parallel_eval-1">parallel_eval/1</a></li>
<li title="pmap-3"><a href="rpc.html#pmap-3">pmap/3</a></li>
<li title="pinfo-1"><a href="rpc.html#pinfo-1">pinfo/1</a></li>
<li title="pinfo-2"><a href="rpc.html#pinfo-2">pinfo/2</a></li>
</ul>
</li>
<li id="no" title="seq_trace " expanded="false">seq_trace<ul>
<li><a href="seq_trace.html">
                  Top of manual page
                </a></li>
<li title="set_token-1"><a href="seq_trace.html#set_token-1">set_token/1</a></li>
<li title="set_token-2"><a href="seq_trace.html#set_token-2">set_token/2</a></li>
<li title="get_token-0"><a href="seq_trace.html#get_token-0">get_token/0</a></li>
<li title="get_token-1"><a href="seq_trace.html#get_token-1">get_token/1</a></li>
<li title="print-1"><a href="seq_trace.html#print-1">print/1</a></li>
<li title="print-2"><a href="seq_trace.html#print-2">print/2</a></li>
<li title="reset_trace-0"><a href="seq_trace.html#reset_trace-0">reset_trace/0</a></li>
<li title="set_system_tracer-1"><a href="seq_trace.html#set_system_tracer-1">set_system_tracer/1</a></li>
<li title="get_system_tracer-0"><a href="seq_trace.html#get_system_tracer-0">get_system_tracer/0</a></li>
</ul>
</li>
<li title="user"><a href="user.html">user</a></li>
<li id="no" title="wrap_log_reader " expanded="false">wrap_log_reader<ul>
<li><a href="wrap_log_reader.html">
                  Top of manual page
                </a></li>
<li title="chunk-1"><a href="wrap_log_reader.html#chunk-1">chunk/1</a></li>
<li title="chunk-2"><a href="wrap_log_reader.html#chunk-2">chunk/2</a></li>
<li title="close-1"><a href="wrap_log_reader.html#close-1">close/1</a></li>
<li title="open-1"><a href="wrap_log_reader.html#open-1">open/1</a></li>
<li title="open-2"><a href="wrap_log_reader.html#open-2">open/2</a></li>
</ul>
</li>
<li title="zlib"><a href="zlib.html">zlib</a></li>
<li title="app"><a href="app.html">app</a></li>
<li title="config"><a href="config.html">config</a></li>
<li title="packages"><a href="packages.html">packages</a></li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>inet</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">inet</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">Access to TCP/IP Protocols</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>Provides access to TCP/IP protocols.</p>
    <p>See also <strong>ERTS User's Guide, Inet configuration</strong> for more
      information on how to configure an Erlang runtime system for IP
      communication.</p>
    <p>Two Kernel configuration parameters affect the behaviour of all
      sockets opened on an Erlang node:
      <span class="code">inet_default_connect_options</span> can contain a list of default
      options used for all sockets returned when doing <span class="code">connect</span>,
      and <span class="code">inet_default_listen_options</span> can contain a list of
      default options used when issuing a <span class="code">listen</span> call. When
      <span class="code">accept</span> is issued, the values of the listensocket options
      are inherited, why no such application variable is needed for
      <span class="code">accept</span>.</p>
    <p>Using the Kernel configuration parameters mentioned above, one
      can set default options for all TCP sockets on a node. This should
      be used with care, but options like <span class="code">{delay_send,true}</span>
      might be specified in this way. An example of starting an Erlang
      node with all sockets using delayed send could look like this:</p>
    <div class="example"><pre>
$ <span class="bold_code">erl -sname test -kernel \</span>
<span class="bold_code">inet_default_connect_options '[{delay_send,true}]' \</span>
<span class="bold_code">inet_default_listen_options '[{delay_send,true}]'</span></pre></div>
    <p>Note that the default option <span class="code">{active, true}</span> currently
      cannot be changed, for internal reasons.</p>
    <p>Addresses as inputs to functions can be either a string or a
      tuple. For instance, the IP address 150.236.20.73 can be passed to
      <span class="code">gethostbyaddr/1</span> either as the string "150.236.20.73"
      or as the tuple <span class="code">{150, 236, 20, 73}</span>.</p>
    <p>IPv4 address examples:</p>
    <div class="example"><pre>
Address          ip_address()
-------          ------------
127.0.0.1        {127,0,0,1}
192.168.42.2     {192,168,42,2}</pre></div>
    <p>IPv6 address examples:</p>
    <div class="example"><pre>
Address          ip_address()
-------          ------------
::1             {0,0,0,0,0,0,0,1}
::192.168.42.2  {0,0,0,0,0,0,(192 bsl 8) bor 168,(42 bsl 8) bor 2}
FFFF::192.168.42.2
                {16#FFFF,0,0,0,0,0,(192 bsl 8) bor 168,(42 bsl 8) bor 2}
3ffe:b80:1f8d:2:204:acff:fe17:bf38
                {16#3ffe,16#b80,16#1f8d,16#2,16#204,16#acff,16#fe17,16#bf38}
fe80::204:acff:fe17:bf38
                {16#fe80,0,0,0,0,16#204,16#acff,16#fe17,16#bf38}</pre></div>
    <p>A function that may be useful is <span class="code">inet_parse:address/1</span>:</p>
    <div class="example"><pre>
1&gt; <span class="bold_code">inet_parse:address("192.168.42.2").</span>
{ok,{192,168,42,2}}
2&gt; <span class="bold_code">inet_parse:address("FFFF::192.168.42.2").</span>
{ok,{65535,0,0,0,0,0,49320,10754}}</pre></div>
  </p></div>

  <h3>DATA TYPES</h3>
    <p>
      <span class="bold_code"><a name="type-hostent">hostent()</a> = <br>    #hostent{h_name = undefined | <span class="bold_code"><a href="inet.html#type-hostname">inet:hostname()</a></span>,<br>             h_aliases = [<span class="bold_code"><a href="inet.html#type-hostname">inet:hostname()</a></span>],<br>             h_addrtype = undefined | inet | inet6,<br>             h_length = undefined | integer() &gt;= 0,<br>             h_addr_list = [<span class="bold_code"><a href="inet.html#type-ip_address">inet:ip_address()</a></span>]}</span><br></p>
<div class="REFBODY"><p>
        <p>The record is defined in the Kernel include file "inet.hrl".
          Add the following directive to the module:</p>
<div class="example"><pre>-include_lib("kernel/include/inet.hrl").</pre></div></p></div>
    <p>
      <span class="bold_code"><a name="type-hostname">hostname()</a> = atom() | string()</span><br></p>
    <p>
      <span class="bold_code"><a name="type-ip_address">ip_address()</a> = <span class="bold_code"><a href="#type-ip4_address">ip4_address()</a></span> | <span class="bold_code"><a href="#type-ip6_address">ip6_address()</a></span></span><br></p>
    <p>
      <span class="bold_code"><a name="type-ip4_address">ip4_address()</a> = {0..255, 0..255, 0..255, 0..255}</span><br></p>
    <p>
      <span class="bold_code"><a name="type-ip6_address">ip6_address()</a> = <br>    {0..65535,<br>     0..65535,<br>     0..65535,<br>     0..65535,<br>     0..65535,<br>     0..65535,<br>     0..65535,<br>     0..65535}</span><br></p>
    <p>
      <span class="bold_code"><a name="type-port_number">port_number()</a> = 0..65535</span><br></p>
    <p>
      <span class="bold_code"><a name="type-posix">posix()</a> = exbadport | exbadseq | <span class="bold_code"><a href="file.html#type-posix">file:posix()</a></span></span><br></p>
<div class="REFBODY"><p><p>An atom which is named from the Posix error codes
         used in Unix, and in the runtime libraries of most
          C compilers. See
          <span class="bold_code"><a href="#error_codes">POSIX Error Codes</a></span>.</p>
      </p></div>
    <p><span class="bold_code"><a name="type-socket">socket()</a></span></p>
<div class="REFBODY"><p><p>See <span class="bold_code"><a href="gen_tcp.html#type-socket">gen_tcp(3)</a></span>
         and <span class="bold_code"><a href="gen_udp.html#type-socket">gen_udp(3)</a></span>.</p>
      </p></div>
    <p>
      <span class="bold_code"><a name="type-address_family">address_family()</a> = inet | inet6</span><br></p>
  

  <h3>EXPORTS</h3>
    <p><a name="close-1"></a><span class="bold_code">close(Socket) -&gt; ok</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Closes a socket of any type.</p>
      </p></div>
    <p><a name="get_rc-0"></a><span class="bold_code">get_rc() -&gt; [{Par :: any(), Val :: any()}]</span><br></p>
<div class="REFBODY"><p>
        <p>Returns the state of the Inet configuration database in 
          form of a list of recorded configuration parameters. (See the
          ERTS User's Guide, Inet configuration, for more information).
          Only parameters with other than default values are returned.</p>
      </p></div>
    <p><a name="format_error-1"></a><span class="bold_code">format_error(Reason) -&gt; string()</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Reason = <span class="bold_code"><a href="#type-posix">posix()</a></span> | system_limit</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a diagnostic error string. See the section below
          for possible Posix values and the corresponding
          strings.</p>
      </p></div>
    <p><a name="getaddr-2"></a><span class="bold_code">getaddr(Host, Family) -&gt; {ok, Address} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Host = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span> | <span class="bold_code"><a href="#type-hostname">hostname()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Family = <span class="bold_code"><a href="#type-address_family">address_family()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Address = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the IP-address for <span class="code">Host</span> as a tuple of
          integers. <span class="code">Host</span> can be an IP-address, a single hostname
          or a fully qualified hostname.</p>
      </p></div>
    <p><a name="getaddrs-2"></a><span class="bold_code">getaddrs(Host, Family) -&gt; {ok, Addresses} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Host = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span> | <span class="bold_code"><a href="#type-hostname">hostname()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Family = <span class="bold_code"><a href="#type-address_family">address_family()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Addresses = [<span class="bold_code"><a href="#type-ip_address">ip_address()</a></span>]</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a list of all IP-addresses for <span class="code">Host</span>.
          <span class="code">Host</span> can be an IP-address, a single hostname or a fully
          qualified hostname.</p>
      </p></div>
    <p><a name="gethostbyaddr-1"></a><span class="bold_code">gethostbyaddr(Address) -&gt; {ok, Hostent} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Address = string() | <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Hostent = <span class="bold_code"><a href="#type-hostent">hostent()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a <span class="code">hostent</span> record given an address.</p>
      </p></div>
    <p><a name="gethostbyname-1"></a><span class="bold_code">gethostbyname(Hostname) -&gt; {ok, Hostent} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Hostname = <span class="bold_code"><a href="#type-hostname">hostname()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Hostent = <span class="bold_code"><a href="#type-hostent">hostent()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a <span class="code">hostent</span> record given a hostname.</p>
      </p></div>
    <p><a name="gethostbyname-2"></a><span class="bold_code">gethostbyname(Hostname, Family) -&gt;<br>                 {ok, Hostent} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Hostname = <span class="bold_code"><a href="#type-hostname">hostname()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Family = <span class="bold_code"><a href="#type-address_family">address_family()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Hostent = <span class="bold_code"><a href="#type-hostent">hostent()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns a <span class="code">hostent</span> record given a hostname, restricted
          to the given address family.</p>
      </p></div>
    <p><a name="gethostname-0"></a><span class="bold_code">gethostname() -&gt; {ok, Hostname}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Hostname = string()</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the local hostname. Will never fail.</p>
      </p></div>

    <p><a name="getifaddrs-0"></a><span class="bold_code">getifaddrs() -&gt; {ok, Iflist} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Iflist = [{Ifname, [Ifopt]}]</span></div>
<div class="REFTYPES"><span class="bold_code">Ifname = string()</span></div>
<div class="REFTYPES"><span class="bold_code">Ifopt = {flag, [Flag]}<br>      | {addr, Addr}<br>      | {netmask, Netmask}<br>      | {broadaddr, Broadaddr}<br>      | {dstaddr, Dstaddr}<br>      | {hwaddr, Hwaddr}</span></div>
<div class="REFTYPES"><span class="bold_code">Flag = up<br>     | broadcast<br>     | loopback<br>     | pointtopoint<br>     | running<br>     | multicast</span></div>
<div class="REFTYPES"><span class="bold_code">Addr = Netmask = Broadaddr = Dstaddr = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
<div class="REFTYPES"><span class="bold_code"></span></div>
<div class="REFTYPES"><span class="bold_code">Hwaddr = [byte()]</span></div>
</div></p>
<div class="REFBODY"><p>
      <p>
	Returns a list of 2-tuples containing interface names and the
	interface's addresses. <span class="code">Ifname</span> is a Unicode string.
	<span class="code">Hwaddr</span> is hardware dependent, e.g on Ethernet interfaces
	it is the 6-byte Ethernet address (MAC address (EUI-48 address)).
      </p>
      <p>
	The <span class="code">{addr,Addr}</span>, <span class="code">{netmask,_}</span> and <span class="code">{broadaddr,_}</span>
	tuples are repeated in the result list iff the interface has multiple
	addresses. If you come across an interface that has
	multiple <span class="code">{flag,_}</span> or <span class="code">{hwaddr,_}</span> tuples you have
	a really strange interface or possibly a bug in this function.
	The <span class="code">{flag,_}</span> tuple is mandatory, all other optional.
      </p>
      <p>
	Do not rely too much on the order of <span class="code">Flag</span> atoms or
	<span class="code">Ifopt</span> tuples. There are some rules, though:
	<ul>
	  <li>
	    Immediately after <span class="code">{addr,_}</span> follows <span class="code">{netmask,_}</span>
	  </li>
	  <li>
	    Immediately thereafter follows <span class="code">{broadaddr,_}</span> if
	    the <span class="code">broadcast</span> flag is <strong>not</strong> set and the
	    <span class="code">pointtopoint</span> flag <strong>is</strong> set.
	  </li>
	  <li>
	    Any <span class="code">{netmask,_}</span>, <span class="code">{broadaddr,_}</span> or
	    <span class="code">{dstaddr,_}</span> tuples that follow an <span class="code">{addr,_}</span>
	    tuple concerns that address.
	  </li>
	</ul>
      </p>
      <p>
	The <span class="code">{hwaddr,_}</span> tuple is not returned on Solaris since the
	hardware address historically belongs to the link layer and only
	the superuser can read such addresses.
      </p>
      <p>
	On Windows, the data is fetched from quite different OS API
	functions, so the <span class="code">Netmask</span> and <span class="code">Broadaddr</span>
	values may be calculated, just as some <span class="code">Flag</span> values.
	You have been warned. Report flagrant bugs.
      </p>
    </p></div>

    <p><a name="getopts-2"></a><span class="bold_code">getopts(Socket, Options) -&gt; {ok, OptionValues} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Options = [socket_getopt()]</span></div>
<div class="REFTYPES"><span class="bold_code">OptionValues = [socket_setopt()]</span></div>
<div class="REFTYPES">
      <span class="bold_code">socket_getopt() = <span class="bold_code"><a href="gen_sctp.html#type-option_name">gen_sctp:option_name()</a></span><br>                | <span class="bold_code"><a href="gen_tcp.html#type-option_name">gen_tcp:option_name()</a></span><br>                | <span class="bold_code"><a href="gen_udp.html#type-option_name">gen_udp:option_name()</a></span></span><br>
</div>
<div class="REFTYPES">
      <span class="bold_code">socket_setopt() = <span class="bold_code"><a href="gen_sctp.html#type-option">gen_sctp:option()</a></span><br>                | <span class="bold_code"><a href="gen_tcp.html#type-option">gen_tcp:option()</a></span><br>                | <span class="bold_code"><a href="gen_udp.html#type-option">gen_udp:option()</a></span></span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Gets one or more options for a socket. 
          See <span class="bold_code"><a href="#setopts-2">setopts/2</a></span> 
          for a list of available options.</p>
        <p>The number of elements in the returned <span class="code">OptionValues</span>
          list does not necessarily correspond to the number of options
          asked for. If the operating system fails to support an option,
          it is simply left out in the returned list. An error tuple is only
          returned when getting options for the socket is impossible
          (i.e. the socket is closed or the buffer size in a raw request
          is too large). This behavior is kept for backward
          compatibility reasons.</p>
        <p>A raw option request <span class="code">RawOptReq = {raw, Protocol, OptionNum, ValueSpec}</span> can be used to get information about
          socket options not (explicitly) supported by the emulator. The
          use of raw socket options makes the code non portable, but
          allows the Erlang programmer to take advantage of unusual features
          present on the current platform.</p>
        <p>The <span class="code">RawOptReq</span> consists of the tag <span class="code">raw</span> followed
          by the protocol level, the option number and either a binary
          or the size, in bytes, of the
          buffer in which the option value is to be stored. A binary
          should be used when the underlying <span class="code">getsockopt</span> requires 
          <strong>input</strong>
          in the argument field, in which case the size of the binary
          should correspond to the required buffer
          size of the return value. The supplied values in a <span class="code">RawOptReq</span>
          correspond to the second, third and fourth/fifth parameters to the
          <span class="code">getsockopt</span> call in the C socket API. The value stored
          in the buffer is returned as a binary <span class="code">ValueBin</span> 
          where all values are coded in the native endianess.</p>
        <p>Asking for and inspecting raw socket options require low
          level information about the current operating system and TCP
          stack.</p>
        <p>As an example, consider a Linux machine where the
          <span class="code">TCP_INFO</span> option could be used to collect TCP statistics
          for a socket. Lets say we're interested in the
          <span class="code">tcpi_sacked</span> field of the <span class="code">struct tcp_info</span>
          filled in when asking for <span class="code">TCP_INFO</span>. To
          be able to access this information, we need to know both the
          numeric value of the protocol level <span class="code">IPPROTO_TCP</span>, the
          numeric value of the option <span class="code">TCP_INFO</span>, the size of the
          <span class="code">struct tcp_info</span> and the size and offset of
          the specific field. By inspecting the headers or writing a small C
          program, we found <span class="code">IPPROTO_TCP</span> to be 6,
          <span class="code">TCP_INFO</span> to be 11, the structure size to be 92 (bytes),
          the offset of <span class="code">tcpi_sacked</span> to be 28 bytes and the actual
          value to be a 32 bit integer. We could use the following
          code to retrieve the value:</p>
        <div class="example"><pre>
        get_tcpi_sacked(Sock) -&gt; 
            {ok,[{raw,_,_,Info}]} = inet:getopts(Sock,[{raw,6,11,92}]),
            &lt;&lt;_:28/binary,TcpiSacked:32/native,_/binary&gt;&gt; = Info,
            TcpiSacked.</pre></div>
        <p>Preferably, you would check the machine type, the OS
          and the kernel version prior to executing anything similar to the
          code above.</p>
      </p></div>

    <p><a name="getstat-1"></a><span class="bold_code">getstat(Socket) -&gt; {ok, OptionValues} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><a name="getstat-2"></a><span class="bold_code">getstat(Socket, Options) -&gt; {ok, OptionValues} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Options = [stat_option()]</span></div>
<div class="REFTYPES"><span class="bold_code">OptionValues = [{stat_option(), integer()}]</span></div>
<div class="REFTYPES">
      <span class="bold_code">stat_option() = recv_cnt<br>              | recv_max<br>              | recv_avg<br>              | recv_oct<br>              | recv_dvi<br>              | send_cnt<br>              | send_max<br>              | send_avg<br>              | send_oct<br>              | send_pend</span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Gets one or more statistic options for a socket.</p>
	<p><span class="code">getstat(Socket)</span> is equivalent to
	<span class="code">getstat(Socket, [recv_avg, recv_cnt, recv_dvi, recv_max, recv_oct, send_avg, send_cnt, send_dvi, send_max, send_oct])</span></p>
	  <p>The following options are available:</p>
        <dl>
	  <dt><strong><span class="code">recv_avg</span></strong></dt>
	  <dd>
            <p>Average size of packets in bytes received to the socket.</p>
	  </dd>
	  <dt><strong><span class="code">recv_cnt</span></strong></dt>
	  <dd>
            <p>Number of packets received to the socket.</p>
	  </dd>
	  <dt><strong><span class="code">recv_dvi</span></strong></dt>
	  <dd>
            <p>Average packet size deviation in bytes received to the socket.</p>
	  </dd>
	  <dt><strong><span class="code">recv_max</span></strong></dt>
	  <dd>
            <p>The size of the largest packet in bytes received to the socket.</p>
	  </dd>
	  <dt><strong><span class="code">recv_oct</span></strong></dt>
	  <dd>
            <p>Number of bytes received to the socket.</p>
	  </dd>

	  <dt><strong><span class="code">send_avg</span></strong></dt>
	  <dd>
            <p>Average size of packets in bytes sent from the socket.</p>
	  </dd>
	  <dt><strong><span class="code">send_cnt</span></strong></dt>
	  <dd>
            <p>Number of packets sent from the socket.</p>
	  </dd>
	  <dt><strong><span class="code">send_dvi</span></strong></dt>
	  <dd>
            <p>Average packet size deviation in bytes received sent from the socket.</p>
	  </dd>
	  <dt><strong><span class="code">send_max</span></strong></dt>
	  <dd>
            <p>The size of the largest packet in bytes sent from the socket.</p>
	  </dd>
	  <dt><strong><span class="code">send_oct</span></strong></dt>
	  <dd>
            <p>Number of bytes sent from the socket.</p>
	  </dd>
        </dl>
      </p></div>

    <p><a name="peername-1"></a><span class="bold_code">peername(Socket) -&gt; {ok, {Address, Port}} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Address = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Port = integer() &gt;= 0</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the address and port for the other end of a
          connection.</p>
      </p></div>
    <p><a name="port-1"></a><span class="bold_code">port(Socket) -&gt; {ok, Port} | {error, any()}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Port = <span class="bold_code"><a href="#type-port_number">port_number()</a></span></span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the local port number for a socket.</p>
      </p></div>
    <p><a name="sockname-1"></a><span class="bold_code">sockname(Socket) -&gt; {ok, {Address, Port}} | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Address = <span class="bold_code"><a href="#type-ip_address">ip_address()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Port = integer() &gt;= 0</span></div>
</div></p>
<div class="REFBODY"><p>
        <p>Returns the local address and port number for a socket.</p>
      </p></div>
    <p><a name="setopts-2"></a><span class="bold_code">setopts(Socket, Options) -&gt; ok | {error, <span class="bold_code"><a href="#type-posix">posix()</a></span>}</span><br><div class="REFBODY">
<p>Types:</p>
<div class="REFTYPES"><span class="bold_code">Socket = <span class="bold_code"><a href="#type-socket">socket()</a></span></span></div>
<div class="REFTYPES"><span class="bold_code">Options = [socket_setopt()]</span></div>
<div class="REFTYPES">
      <span class="bold_code">socket_setopt() = <span class="bold_code"><a href="gen_sctp.html#type-option">gen_sctp:option()</a></span><br>                | <span class="bold_code"><a href="gen_tcp.html#type-option">gen_tcp:option()</a></span><br>                | <span class="bold_code"><a href="gen_udp.html#type-option">gen_udp:option()</a></span></span><br>
</div>
</div></p>
<div class="REFBODY"><p>
        <p>Sets one or more options for a socket. The following options
          are available:</p>
        <dl>
          <dt><strong><span class="code">{active, true | false | once}</span></strong></dt>
          <dd>
            <p>If the value is <span class="code">true</span>, which is the default,
              everything received from the socket will be sent as
              messages to the receiving process. If the value is
              <span class="code">false</span> (passive mode), the process must explicitly
              receive incoming data by calling <span class="code">gen_tcp:recv/2,3</span>
              or <span class="code">gen_udp:recv/2,3</span> (depending on the type of
              socket).</p>
            <p>If the value is <span class="code">once</span> (<span class="code">{active, once}</span>),
              <strong>one</strong> data message from the socket will be sent
              to the process.  To receive one more message,
              <span class="code">setopts/2</span> must be called again with the
              <span class="code">{active, once}</span> option.</p>
            <p>When using <span class="code">{active, once}</span>, the socket changes
              behaviour automatically when data is received. This can
              sometimes be confusing in combination with connection
              oriented sockets (i.e. <span class="code">gen_tcp</span>) as a socket with
              <span class="code">{active, false}</span> behaviour reports closing
              differently than a socket with <span class="code">{active, true}</span>
              behaviour. To make programming easier, a socket where
              the peer closed and this was detected while in
              <span class="code">{active, false}</span> mode, will still generate the
              message
              <span class="code">{tcp_closed,Socket}</span> when set to <span class="code">{active, once}</span> or <span class="code">{active, true}</span> mode. It is therefore
              safe to assume that the message
              <span class="code">{tcp_closed,Socket}</span>, possibly followed by socket
              port termination (depending on the <span class="code">exit_on_close</span>
              option) will eventually appear when a socket changes
              back and forth between <span class="code">{active, true}</span> and
              <span class="code">{active, false}</span> mode. However, 
              <strong>when</strong> peer closing is detected is all up to the
              underlying TCP/IP stack and protocol.</p>
            <p>Note that <span class="code">{active,true}</span> mode provides no flow
              control; a fast sender could easily overflow the
              receiver with incoming messages. Use active mode only if
              your high-level protocol provides its own flow control
              (for instance, acknowledging received messages) or the
              amount of data exchanged is small. <span class="code">{active,false}</span>
              mode or use of the <span class="code">{active, once}</span> mode provides
              flow control; the other side will not be able send
              faster than the receiver can read.</p>
          </dd>

		  <dt><strong><span class="code">{bit8, clear | set | on | off}</span></strong></dt>
		  <dd>
			  <p>
				  Scans every byte in received data-packets and checks if the 8 bit
				  is set in any of them. Information is retrieved with
				  <span class="code">inet:getopts/2</span>.
			  </p>
			  <p>Note that the <span class="code">bit8</span> option is deprecated and will be removed in Erlang/OTP R16.</p>
		  </dd>

          <dt><strong><span class="code">{broadcast, Boolean}</span>(UDP sockets)</strong></dt>
          <dd>
            <p>Enable/disable permission to send broadcasts.</p>
			<a name="option-buffer"></a>
          </dd>

		  <dt><strong><span class="code">{buffer, Size}</span></strong></dt>
		  <dd>
			  <p>Determines the size of the user-level software buffer used by
				  the driver. Not to be confused with <span class="code">sndbuf</span>
				  and <span class="code">recbuf</span> options which correspond to
				  the kernel socket buffers. It is recommended
				  to have <span class="code">val(buffer) &gt;= max(val(sndbuf),val(recbuf))</span>.
				  In fact, the <span class="code">val(buffer)</span> is automatically set to
				  the above maximum when <span class="code">sndbuf</span> or <span class="code">recbuf</span> values are set.</p>
		  </dd>

          <dt><strong><span class="code">{delay_send, Boolean}</span></strong></dt>
          <dd>
            <p>Normally, when an Erlang process sends to a socket,
              the driver will try to immediately send the data. If that
              fails, the driver will use any means available to queue
              up the message to be sent whenever the operating system
              says it can handle it. Setting <span class="code">{delay_send, true}</span>
              will make <strong>all</strong> messages queue up. This makes
              the messages actually sent onto the network be larger but
              fewer. The option actually affects the scheduling of send
              requests versus Erlang processes instead of changing any
              real property of the socket. Needless to say it is an
              implementation specific option. Default is <span class="code">false</span>.</p>
          </dd>

		  <dt><strong><span class="code">{deliver, port | term}</span></strong></dt>
		  <dd> <p> When <span class="code">{active, true}</span> delivers data on the forms
				  <span class="code">port</span> : <span class="code">{S, {data, [H1,..Hsz | Data]}}</span> or
				  <span class="code">term</span> : <span class="code">{tcp, S, [H1..Hsz | Data]}</span>.
				  </p>
		  </dd>

          <dt><strong><span class="code">{dontroute, Boolean}</span></strong></dt>
          <dd>
            <p>Enable/disable routing bypass for outgoing messages.</p>
          </dd>

          <dt><strong><span class="code">{exit_on_close, Boolean}</span></strong></dt>
          <dd>
            <p>By default this option is set to <span class="code">true</span>.</p>
            <p>The only reason to set it to <span class="code">false</span> is if you want
              to continue sending data to the socket after a close has
              been detected, for instance if the peer has used
              <span class="bold_code"><a href="gen_tcp.html#shutdown-2">gen_tcp:shutdown/2</a></span>
              to shutdown the write side.</p>
          </dd>

          <dt><strong><span class="code">{header, Size}</span></strong></dt>
          <dd>
            <p>This option is only meaningful if the <span class="code">binary</span>
              option was specified when the socket was created. If
              the <span class="code">header</span> option is specified, the first
              <span class="code">Size</span> number bytes of data received from the socket
              will be elements of a list, and the rest of the data will
              be a binary given as the tail of the same list. If for
              example <span class="code">Size == 2</span>, the data received will match
              <span class="code">[Byte1,Byte2|Binary]</span>.</p>
          </dd>

		  <dt><strong><span class="code">{high_watermark, Size}</span></strong></dt>
		  <dd> <p>
				  Sender is forced busy if sent and enqueued data
				  reaches the highwater mark.
				  <br> Default: 8192 kB. 
			  </p>
		  </dd>

          <dt><strong><span class="code">{keepalive, Boolean}</span>(TCP/IP sockets)</strong></dt>
          <dd>
            <p>Enables/disables periodic transmission on a connected
              socket, when no other data is being exchanged. If
              the other end does not respond, the connection is
              considered broken and an error message will be sent to
              the controlling process. Default disabled.</p>
			<a name="option-linger"></a>
          </dd>

		  <dt><strong><span class="code">{linger, {true|false, Seconds}}</span></strong></dt>
		  <dd>
			  <p>Determines the timeout in seconds for flushing unsent data in the
				  <span class="code">close/1</span> socket call. If the 1st component of the value
				  tuple is <span class="code">false</span>, the 2nd one is ignored, which means that
				  <span class="code">close/1</span> returns immediately not waiting
				  for data to be flushed. Otherwise, the 2nd component is
				  the flushing time-out in seconds.</p>
		  </dd>

		  <dt><strong><span class="code">{low_watermark, Size}</span></strong></dt>
		  <dd> <p>
				  If the port has reached its <span class="code">high_watermark</span> it will
				  force busy onto senders. When the port data queue reaches the
				  <span class="code">low_watermark</span> callers are no longer forced busy.
				  <br> Default: 4096 kB. 
			  </p>
		  </dd>

		  <dt><strong><span class="code">{mode, Mode :: binary | list}</span></strong></dt>
          <dd>
			  <p>Received <span class="code">Packet</span> is delivered as defined by Mode.</p>
		  </dd>

		  <dt><strong><span class="code">list</span></strong></dt>
          <dd>
			  <p>Received <span class="code">Packet</span> is delivered as a list.</p>
		  </dd>

		  <dt><strong><span class="code">binary</span></strong></dt>
          <dd>
			  <p>Received <span class="code">Packet</span> is delivered as a binary.</p>
		  </dd>

          <dt><strong><span class="code">{nodelay, Boolean}</span>(TCP/IP sockets)</strong></dt>
          <dd>
            <p>If <span class="code">Boolean == true</span>, the <span class="code">TCP_NODELAY</span> option
              is turned on for the socket, which means that even small
              amounts of data will be sent immediately.</p>
          </dd>
          <dt><strong><span class="code">{packet, PacketType}</span>(TCP/IP sockets)</strong></dt>
          <dd>
            <p>Defines the type of packets to use for a socket.
              The following values are valid:</p>
            <dl>
              <dt><strong><span class="code">raw | 0</span></strong></dt>
              <dd>
                <p>No packaging is done.</p>
              </dd>
              <dt><strong><span class="code">1 | 2 | 4</span></strong></dt>
              <dd>
                <p>Packets consist of a header specifying the number of
                  bytes in the packet, followed by that number of bytes.
                  The length of header can be one, two, or four bytes;
                  containing an unsigned integer in big-endian byte order.
                  Each send operation will generate the header, and the header
                  will be stripped off on each receive operation.</p>
                <p>In current implementation the 4-byte header is limited to 2Gb.</p>
              </dd>
              <dt><strong><span class="code">asn1 | cdr | sunrm | fcgi | tpkt | line</span></strong></dt>
              <dd>
                <p>These packet types only have effect on receiving.
                  When sending a packet, it is the responsibility of
                  the application to supply a correct header. On
                  receiving, however, there will be one message sent to
                  the controlling process for each complete packet
                  received, and, similarly, each call to
                  <span class="code">gen_tcp:recv/2,3</span> returns one complete packet.
                  The header is <strong>not</strong> stripped off.</p>
                <p>The meanings of the packet types are as follows:
                                    <br>
<span class="code">asn1</span> - ASN.1 BER,
                                    <br>
<span class="code">sunrm</span> - Sun's RPC encoding,
                                    <br>
<span class="code">cdr</span> - CORBA (GIOP 1.1),
                                    <br>
<span class="code">fcgi</span> - Fast CGI,
                                    <br>
<span class="code">tpkt</span> - TPKT format [RFC1006],
                                    <br>
<span class="code">line</span> - Line mode, a packet is a line
                  terminated with newline, lines longer than
                  the receive buffer are truncated.</p>
              </dd>
              <dt><strong><span class="code">http | http_bin</span></strong></dt>
              <dd>
                <p>The Hypertext Transfer Protocol. The packets
                 are returned with the format according to <span class="code">HttpPacket</span>
                 described in <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#decode_packet-3');">
                 erlang:decode_packet/3</a></span>. A socket in passive
                 mode will return <span class="code">{ok, HttpPacket}</span> from <span class="code">gen_tcp:recv</span>
                 while an active socket will send messages like <span class="code">{http,
                 Socket, HttpPacket}</span>.</p>
              </dd>
              <dt><strong><span class="code">httph | httph_bin</span></strong></dt>
              <dd>
                <p>These two types are often not needed as the socket will
		automatically switch from <span class="code">http</span>/<span class="code">http_bin</span> to
		<span class="code">httph</span>/<span class="code">httph_bin</span> internally after the first line
		has been read. There might be occasions however when they are
		useful, such as parsing trailers from chunked encoding.</p>
              </dd>
            </dl>
          </dd>
          <dt><strong><span class="code">{packet_size, Integer}</span>(TCP/IP sockets)</strong></dt>
          <dd>
            <p>Sets the max allowed length of the packet body. If
              the packet header indicates that the length of the packet
              is longer than the max allowed length, the packet is
              considered invalid. The same happens if the packet header
              is too big for the socket receive buffer.</p>
	    <p>For line oriented protocols (<span class="code">line</span>,<span class="code">http*</span>),
	    option <span class="code">packet_size</span> also guarantees that lines up to the
	    indicated length are accepted and not considered invalid due
	    to internal buffer limitations.</p>
          </dd>

		  <dt><strong><span class="code">{priority, Priority}</span></strong></dt>
          <dd> <p>Set the protocol-defined priority for all packets to be sent
			  on this socket.</p>
		  </dd>

		  <dt><strong><span class="code">{raw, Protocol, OptionNum, ValueBin}</span></strong></dt>
          <dd> <p>See below.</p>
		  </dd>

          <dt><strong><span class="code">{read_packets, Integer}</span>(UDP sockets)</strong></dt>
          <dd>
            <p>Sets the max number of UDP packets to read without
              intervention from the socket when data is available.
              When this many packets have been read and delivered
              to the destination process, new packets are not read
              until a new notification of available data has arrived.
              The default is 5, and if this parameter is set too
              high the system can become unresponsive due to
              UDP packet flooding.</p>
          </dd>
          <dt><strong><span class="code">{recbuf, Size}</span></strong></dt>
          <dd>
            <p>Gives the size of the receive buffer to use for
              the socket.</p>
          </dd>
          <dt><strong><span class="code">{reuseaddr, Boolean}</span></strong></dt>
          <dd>
            <p>Allows or disallows local reuse of port numbers. By
              default, reuse is disallowed.</p>
          </dd>
          <dt><strong><span class="code">{send_timeout, Integer}</span></strong></dt>
          <dd>
            <p>Only allowed for connection oriented sockets.</p>
            <p>Specifies a longest time to wait for a send operation to
              be accepted by the underlying TCP stack. When the limit is
              exceeded, the send operation will return
              <span class="code">{error,timeout}</span>. How much of a packet that actually
              got sent is unknown, why the socket should be closed
              whenever a timeout has occurred (see <span class="code">send_timeout_close</span>).
              Default is <span class="code">infinity</span>.</p>
          </dd>
          <dt><strong><span class="code">{send_timeout_close, Boolean}</span></strong></dt>
          <dd>
            <p>Only allowed for connection oriented sockets.</p>
            <p>Used together with <span class="code">send_timeout</span> to specify whether
              the socket will be automatically closed when the send operation
              returns <span class="code">{error,timeout}</span>. The recommended setting is
              <span class="code">true</span> which will automatically close the socket.
              Default is <span class="code">false</span> due to backward compatibility.</p>
			<a name="option-sndbuf"></a>
          </dd>

          <dt><strong><span class="code">{sndbuf, Size}</span></strong></dt>
          <dd>
            <p>Gives the size of the send buffer to use for the socket.</p>
          </dd>
          <dt><strong><span class="code">{priority, Integer}</span></strong></dt>
          <dd>
            <p>Sets the SO_PRIORITY socket level option on platforms where 
              this is implemented. The behaviour and allowed range varies on 
              different systems. The option is ignored on platforms where the 
              option is not implemented. Use with caution.</p>
          </dd>
          <dt><strong><span class="code">{tos, Integer}</span></strong></dt>
          <dd>
            <p>Sets IP_TOS IP level options on platforms where this is 
              implemented. The behaviour and allowed range varies on different 
              systems. The option is ignored on platforms where the option is 
              not implemented. Use with caution.</p>
          </dd>
        </dl>

        <p>In addition to the options mentioned above, <strong>raw</strong>
          option specifications can be used. The raw options are
          specified as a tuple of arity four, beginning with the tag
          <span class="code">raw</span>, followed by the protocol level, the option number
          and the actual option value specified as a binary. This
          corresponds to the second, third and fourth argument to the
          <span class="code">setsockopt</span> call in the C socket API. The option value
          needs to be coded in the native endianess of the platform and,
          if a structure is required, needs to follow the struct
          alignment conventions on the specific platform.</p>
        <p>Using raw socket options require detailed knowledge about
          the current operating system and TCP stack.</p>
        <p>As an example of the usage of raw options, consider a Linux
          system where you want to set the <span class="code">TCP_LINGER2</span> option on
          the <span class="code">IPPROTO_TCP</span> protocol level in the stack. You know
          that on this particular system it defaults to 60 (seconds),
          but you would like to lower it to 30 for a particular
          socket. The <span class="code">TCP_LINGER2</span> option is not explicitly
          supported by inet, but you know that the protocol level
          translates to the number 6, the option number to the number 8
          and the value is to be given as a 32 bit integer. You can use
          this line of code to set the option for the socket named
          <span class="code">Sock</span>:</p>
        <div class="example"><pre>
        inet:setopts(Sock,[{raw,6,8,&lt;&lt;30:32/native&gt;&gt;}]),</pre></div>
        <p>As many options are silently discarded by the stack if they
          are given out of range, it could be a good idea to check that
          a raw option really got accepted. This code places the value
          in the variable TcpLinger2:</p>
        <div class="example"><pre>
        {ok,[{raw,6,8,&lt;&lt;TcpLinger2:32/native&gt;&gt;}]}=inet:getopts(Sock,[{raw,6,8,4}]),</pre></div>
        <p>Code such as the examples above is inherently non portable,
          even different versions of the same  OS on the same platform
          may respond differently to this kind of option
          manipulation. Use with care.</p>
        <p>Note that the default options for TCP/IP sockets can be
          changed with the Kernel configuration parameters mentioned in
          the beginning of this document.</p>
      </p></div>
  

  <h3><a name="id128819">POSIX Error Codes</a></h3>
<div class="REFBODY">
    <a name="error_codes"></a>
    
    <ul>
      <li>
<span class="code">e2big</span> - argument list too long</li>
      <li>
<span class="code">eacces</span> - permission denied</li>
      <li>
<span class="code">eaddrinuse</span> - address already in use</li>
      <li>
<span class="code">eaddrnotavail</span> - cannot assign requested address</li>
      <li>
<span class="code">eadv</span> - advertise error</li>
      <li>
<span class="code">eafnosupport</span> - address family not supported by
       protocol family</li>
      <li>
<span class="code">eagain</span> - resource temporarily unavailable</li>
      <li>
<span class="code">ealign</span> - EALIGN</li>
      <li>
<span class="code">ealready</span> - operation already in progress</li>
      <li>
<span class="code">ebade</span> - bad exchange descriptor</li>
      <li>
<span class="code">ebadf</span> - bad file number</li>
      <li>
<span class="code">ebadfd</span> - file descriptor in bad state</li>
      <li>
<span class="code">ebadmsg</span> - not a data message</li>
      <li>
<span class="code">ebadr</span> - bad request descriptor</li>
      <li>
<span class="code">ebadrpc</span> - RPC structure is bad</li>
      <li>
<span class="code">ebadrqc</span> - bad request code</li>
      <li>
<span class="code">ebadslt</span> - invalid slot</li>
      <li>
<span class="code">ebfont</span> - bad font file format</li>
      <li>
<span class="code">ebusy</span> - file busy</li>
      <li>
<span class="code">echild</span> - no children</li>
      <li>
<span class="code">echrng</span> - channel number out of range</li>
      <li>
<span class="code">ecomm</span> - communication error on send</li>
      <li>
<span class="code">econnaborted</span> - software caused connection abort</li>
      <li>
<span class="code">econnrefused</span> - connection refused</li>
      <li>
<span class="code">econnreset</span> - connection reset by peer</li>
      <li>
<span class="code">edeadlk</span> - resource deadlock avoided</li>
      <li>
<span class="code">edeadlock</span> - resource deadlock avoided</li>
      <li>
<span class="code">edestaddrreq</span> - destination address required</li>
      <li>
<span class="code">edirty</span> - mounting a dirty fs w/o force</li>
      <li>
<span class="code">edom</span> - math argument out of range</li>
      <li>
<span class="code">edotdot</span> - cross mount point</li>
      <li>
<span class="code">edquot</span> - disk quota exceeded</li>
      <li>
<span class="code">eduppkg</span> - duplicate package name</li>
      <li>
<span class="code">eexist</span> - file already exists</li>
      <li>
<span class="code">efault</span> - bad address in system call argument</li>
      <li>
<span class="code">efbig</span> - file too large</li>
      <li>
<span class="code">ehostdown</span> - host is down</li>
      <li>
<span class="code">ehostunreach</span> - host is unreachable</li>
      <li>
<span class="code">eidrm</span> - identifier removed</li>
      <li>
<span class="code">einit</span> - initialization error</li>
      <li>
<span class="code">einprogress</span> - operation now in progress</li>
      <li>
<span class="code">eintr</span> - interrupted system call</li>
      <li>
<span class="code">einval</span> - invalid argument</li>
      <li>
<span class="code">eio</span> - I/O error</li>
      <li>
<span class="code">eisconn</span> - socket is already connected</li>
      <li>
<span class="code">eisdir</span> - illegal operation on a directory</li>
      <li>
<span class="code">eisnam</span> - is a named file</li>
      <li>
<span class="code">el2hlt</span> - level 2 halted</li>
      <li>
<span class="code">el2nsync</span> - level 2 not synchronized</li>
      <li>
<span class="code">el3hlt</span> - level 3 halted</li>
      <li>
<span class="code">el3rst</span> - level 3 reset</li>
      <li>
<span class="code">elbin</span> - ELBIN</li>
      <li>
<span class="code">elibacc</span> - cannot access a needed shared library</li>
      <li>
<span class="code">elibbad</span> - accessing a corrupted shared library</li>
      <li>
<span class="code">elibexec</span> - cannot exec a shared library directly</li>
      <li>
<span class="code">elibmax</span> - attempting to link in more shared
       libraries than system limit</li>
      <li>
<span class="code">elibscn</span> - .lib section in a.out corrupted</li>
      <li>
<span class="code">elnrng</span> - link number out of range</li>
      <li>
<span class="code">eloop</span> - too many levels of symbolic links</li>
      <li>
<span class="code">emfile</span> - too many open files</li>
      <li>
<span class="code">emlink</span> - too many links</li>
      <li>
<span class="code">emsgsize</span> - message too long</li>
      <li>
<span class="code">emultihop</span> - multihop attempted</li>
      <li>
<span class="code">enametoolong</span> - file name too long</li>
      <li>
<span class="code">enavail</span> - not available</li>
      <li>
<span class="code">enet</span> - ENET</li>
      <li>
<span class="code">enetdown</span> - network is down</li>
      <li>
<span class="code">enetreset</span> - network dropped connection on reset</li>
      <li>
<span class="code">enetunreach</span> - network is unreachable</li>
      <li>
<span class="code">enfile</span> - file table overflow</li>
      <li>
<span class="code">enoano</span> - anode table overflow</li>
      <li>
<span class="code">enobufs</span> - no buffer space available</li>
      <li>
<span class="code">enocsi</span> - no CSI structure available</li>
      <li>
<span class="code">enodata</span> - no data available</li>
      <li>
<span class="code">enodev</span> - no such device</li>
      <li>
<span class="code">enoent</span> - no such file or directory</li>
      <li>
<span class="code">enoexec</span> - exec format error</li>
      <li>
<span class="code">enolck</span> - no locks available</li>
      <li>
<span class="code">enolink</span> - link has be severed</li>
      <li>
<span class="code">enomem</span> - not enough memory</li>
      <li>
<span class="code">enomsg</span> - no message of desired type</li>
      <li>
<span class="code">enonet</span> - machine is not on the network</li>
      <li>
<span class="code">enopkg</span> - package not installed</li>
      <li>
<span class="code">enoprotoopt</span> - bad protocol option</li>
      <li>
<span class="code">enospc</span> - no space left on device</li>
      <li>
<span class="code">enosr</span> - out of stream resources or not a stream
       device</li>
      <li>
<span class="code">enosym</span> - unresolved symbol name</li>
      <li>
<span class="code">enosys</span> - function not implemented</li>
      <li>
<span class="code">enotblk</span> - block device required</li>
      <li>
<span class="code">enotconn</span> - socket is not connected</li>
      <li>
<span class="code">enotdir</span> - not a directory</li>
      <li>
<span class="code">enotempty</span> - directory not empty</li>
      <li>
<span class="code">enotnam</span> - not a named file</li>
      <li>
<span class="code">enotsock</span> - socket operation on non-socket</li>
      <li>
<span class="code">enotsup</span> - operation not supported</li>
      <li>
<span class="code">enotty</span> - inappropriate device for ioctl</li>
      <li>
<span class="code">enotuniq</span> - name not unique on network</li>
      <li>
<span class="code">enxio</span> - no such device or address</li>
      <li>
<span class="code">eopnotsupp</span> - operation not supported on socket</li>
      <li>
<span class="code">eperm</span> - not owner</li>
      <li>
<span class="code">epfnosupport</span> - protocol family not supported</li>
      <li>
<span class="code">epipe</span> - broken pipe</li>
      <li>
<span class="code">eproclim</span> - too many processes</li>
      <li>
<span class="code">eprocunavail</span> - bad procedure for program</li>
      <li>
<span class="code">eprogmismatch</span> - program version wrong</li>
      <li>
<span class="code">eprogunavail</span> - RPC program not available</li>
      <li>
<span class="code">eproto</span> - protocol error</li>
      <li>
<span class="code">eprotonosupport</span> - protocol not supported</li>
      <li>
<span class="code">eprototype</span> - protocol wrong type for socket</li>
      <li>
<span class="code">erange</span> - math result unrepresentable</li>
      <li>
<span class="code">erefused</span> - EREFUSED</li>
      <li>
<span class="code">eremchg</span> - remote address changed</li>
      <li>
<span class="code">eremdev</span> - remote device</li>
      <li>
<span class="code">eremote</span> - pathname hit remote file system</li>
      <li>
<span class="code">eremoteio</span> - remote i/o error</li>
      <li>
<span class="code">eremoterelease</span> - EREMOTERELEASE</li>
      <li>
<span class="code">erofs</span> - read-only file system</li>
      <li>
<span class="code">erpcmismatch</span> - RPC version is wrong</li>
      <li>
<span class="code">erremote</span> - object is remote</li>
      <li>
<span class="code">eshutdown</span> - cannot send after socket shutdown</li>
      <li>
<span class="code">esocktnosupport</span> - socket type not supported</li>
      <li>
<span class="code">espipe</span> - invalid seek</li>
      <li>
<span class="code">esrch</span> - no such process</li>
      <li>
<span class="code">esrmnt</span> - srmount error</li>
      <li>
<span class="code">estale</span> - stale remote file handle</li>
      <li>
<span class="code">esuccess</span> - Error 0</li>
      <li>
<span class="code">etime</span> - timer expired</li>
      <li>
<span class="code">etimedout</span> - connection timed out</li>
      <li>
<span class="code">etoomanyrefs</span> - too many references</li>
      <li>
<span class="code">etxtbsy</span> - text file or pseudo-device busy</li>
      <li>
<span class="code">euclean</span> - structure needs cleaning</li>
      <li>
<span class="code">eunatch</span> - protocol driver not attached</li>
      <li>
<span class="code">eusers</span> - too many users</li>
      <li>
<span class="code">eversion</span> - version mismatch</li>
      <li>
<span class="code">ewouldblock</span> - operation would block</li>
      <li>
<span class="code">exdev</span> - cross-domain link</li>
      <li>
<span class="code">exfull</span> - message tables full</li>
      <li>
<span class="code">nxdomain</span> - the hostname or domain name could not be
       found</li>
    </ul>
  </div>
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>