File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ \section{Built-in Module \sectcode{socket}}
9696the Python interpreter is currently executing. If you want to know the
9797current machine's IP address, use
9898\code {socket.gethostbyname(socket.gethostname())}.
99+ Note: \code {gethostname()} doesn't always return the fully qualified
100+ domain name; use \code {socket.gethostbyaddr(socket.gethostname())}
101+ (see below).
99102\end {funcdesc }
100103
101104\begin {funcdesc }{gethostbyaddr}{ip_address}
@@ -105,6 +108,8 @@ \section{Built-in Module \sectcode{socket}}
105108alternative host names for the same address, and \code {ipaddrlist} is
106109a list of IP addresses for the same interface on the same
107110host (most likely containing only a single address).
111+ To find the fully qualified domain name, check \var {hostname} and the
112+ items of \var {aliaslist} for an entry containing at least one period.
108113\end {funcdesc }
109114
110115\begin {funcdesc }{getprotobyname}{protocolname}
Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ \section{Built-in Module \sectcode{socket}}
9696the Python interpreter is currently executing. If you want to know the
9797current machine's IP address, use
9898\code {socket.gethostbyname(socket.gethostname())}.
99+ Note: \code {gethostname()} doesn't always return the fully qualified
100+ domain name; use \code {socket.gethostbyaddr(socket.gethostname())}
101+ (see below).
99102\end {funcdesc }
100103
101104\begin {funcdesc }{gethostbyaddr}{ip_address}
@@ -105,6 +108,8 @@ \section{Built-in Module \sectcode{socket}}
105108alternative host names for the same address, and \code {ipaddrlist} is
106109a list of IP addresses for the same interface on the same
107110host (most likely containing only a single address).
111+ To find the fully qualified domain name, check \var {hostname} and the
112+ items of \var {aliaslist} for an entry containing at least one period.
108113\end {funcdesc }
109114
110115\begin {funcdesc }{getprotobyname}{protocolname}
You can’t perform that action at this time.
0 commit comments