mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue #1746656: Add if_nameindex, if_nametoindex, if_indextoname
methods to the socket module.
This commit is contained in:
parent
1a4de20d95
commit
5ed2e779f1
7 changed files with 429 additions and 248 deletions
|
|
@ -536,6 +536,39 @@ The module :mod:`socket` exports the following constants and functions:
|
|||
.. versionadded:: 3.3
|
||||
|
||||
|
||||
.. function:: if_nameindex()
|
||||
|
||||
Returns a list of network interface information
|
||||
(index, name as a byte string) tuples.
|
||||
:exc:`socket.error` if the system call fails for any reason.
|
||||
|
||||
Availability: Unix.
|
||||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
|
||||
.. function:: if_nametoindex(if_name)
|
||||
|
||||
Returns a network interface index number corresponding to an
|
||||
interface name byte string.
|
||||
:exc:`socket.error` if no interface with the given name exists.
|
||||
|
||||
Availability: Unix.
|
||||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
|
||||
.. function:: if_indextoname(if_index)
|
||||
|
||||
Returns a network interface name byte string corresponding to a
|
||||
interface index.
|
||||
:exc:`socket.error` if no interface with the given index exists.
|
||||
|
||||
Availability: Unix.
|
||||
|
||||
.. versionadded:: 3.3
|
||||
|
||||
|
||||
.. data:: SocketType
|
||||
|
||||
This is a Python type object that represents the socket object type. It is the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue