Kaydet (Commit) 781db5d0 authored tarafından Guido van Rossum's avatar Guido van Rossum

* Doc/libsocket.tex (subsection{Socket Object Methods}):

	documented gethostname() and a few misc things
üst 3d0df46f
...@@ -54,14 +54,18 @@ call, similar to the value accompanying \code{posix.error}. ...@@ -54,14 +54,18 @@ call, similar to the value accompanying \code{posix.error}.
\begin{datadesc}{AF_UNIX} \begin{datadesc}{AF_UNIX}
\dataline{AF_INET} \dataline{AF_INET}
These constants represent the address (and protocol) families, These constants represent the address (and protocol) families,
used for the first argument to \code{socket()}. used for the first argument to \code{socket()}. If the \code{AF_UNIX}
constant is not defined then this protocol is unsupported.
\end{datadesc} \end{datadesc}
\begin{datadesc}{SOCK_STREAM} \begin{datadesc}{SOCK_STREAM}
\dataline{SOCK_DGRAM} \dataline{SOCK_DGRAM}
\dataline{SOCK_RAW}
\dataline{SOCK_RDM}
\dataline{SOCK_SEQPACKET}
These constants represent the socket types, These constants represent the socket types,
used for the second argument to \code{socket()}. used for the second argument to \code{socket()}.
(There are other types, but only \code{SOCK_STREAM} and (Only \code{SOCK_STREAM} and
\code{SOCK_DGRAM} appear to be generally useful.) \code{SOCK_DGRAM} appear to be generally useful.)
\end{datadesc} \end{datadesc}
...@@ -71,6 +75,11 @@ returned as a string, e.g., \code{'100.50.200.5'}. If the host name ...@@ -71,6 +75,11 @@ returned as a string, e.g., \code{'100.50.200.5'}. If the host name
is an IP address itself it is returned unchanged. is an IP address itself it is returned unchanged.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{gethostname}{}
Return the current host's canonical name, as a string
(e.g. \code{'voorn.cwi.nl'}).
\end{funcdesc}
\begin{funcdesc}{getservbyname}{servicename\, protocolname} \begin{funcdesc}{getservbyname}{servicename\, protocolname}
Translate an Internet service name and protocol name to a port number Translate an Internet service name and protocol name to a port number
for that service. The protocol name should be \code{'tcp'} or for that service. The protocol name should be \code{'tcp'} or
...@@ -139,7 +148,7 @@ with \code{select}. ...@@ -139,7 +148,7 @@ with \code{select}.
Return the remote address to which the socket is connected. This is Return the remote address to which the socket is connected. This is
useful to find out the port number of a remote IP socket, for instance. useful to find out the port number of a remote IP socket, for instance.
(The format of the address returned depends on the address family -- (The format of the address returned depends on the address family --
see above.) see above.) On some systems this function is not supported.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsockname}{} \begin{funcdesc}{getsockname}{}
......
...@@ -54,14 +54,18 @@ call, similar to the value accompanying \code{posix.error}. ...@@ -54,14 +54,18 @@ call, similar to the value accompanying \code{posix.error}.
\begin{datadesc}{AF_UNIX} \begin{datadesc}{AF_UNIX}
\dataline{AF_INET} \dataline{AF_INET}
These constants represent the address (and protocol) families, These constants represent the address (and protocol) families,
used for the first argument to \code{socket()}. used for the first argument to \code{socket()}. If the \code{AF_UNIX}
constant is not defined then this protocol is unsupported.
\end{datadesc} \end{datadesc}
\begin{datadesc}{SOCK_STREAM} \begin{datadesc}{SOCK_STREAM}
\dataline{SOCK_DGRAM} \dataline{SOCK_DGRAM}
\dataline{SOCK_RAW}
\dataline{SOCK_RDM}
\dataline{SOCK_SEQPACKET}
These constants represent the socket types, These constants represent the socket types,
used for the second argument to \code{socket()}. used for the second argument to \code{socket()}.
(There are other types, but only \code{SOCK_STREAM} and (Only \code{SOCK_STREAM} and
\code{SOCK_DGRAM} appear to be generally useful.) \code{SOCK_DGRAM} appear to be generally useful.)
\end{datadesc} \end{datadesc}
...@@ -71,6 +75,11 @@ returned as a string, e.g., \code{'100.50.200.5'}. If the host name ...@@ -71,6 +75,11 @@ returned as a string, e.g., \code{'100.50.200.5'}. If the host name
is an IP address itself it is returned unchanged. is an IP address itself it is returned unchanged.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{gethostname}{}
Return the current host's canonical name, as a string
(e.g. \code{'voorn.cwi.nl'}).
\end{funcdesc}
\begin{funcdesc}{getservbyname}{servicename\, protocolname} \begin{funcdesc}{getservbyname}{servicename\, protocolname}
Translate an Internet service name and protocol name to a port number Translate an Internet service name and protocol name to a port number
for that service. The protocol name should be \code{'tcp'} or for that service. The protocol name should be \code{'tcp'} or
...@@ -139,7 +148,7 @@ with \code{select}. ...@@ -139,7 +148,7 @@ with \code{select}.
Return the remote address to which the socket is connected. This is Return the remote address to which the socket is connected. This is
useful to find out the port number of a remote IP socket, for instance. useful to find out the port number of a remote IP socket, for instance.
(The format of the address returned depends on the address family -- (The format of the address returned depends on the address family --
see above.) see above.) On some systems this function is not supported.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsockname}{} \begin{funcdesc}{getsockname}{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment