Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit a33fca9

Browse files
author
Paul Sokolovsky
committed
docs/usocket: Document inet_ntop(), inet_pton().
1 parent d1cd533 commit a33fca9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/library/usocket.rst

+16
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,22 @@ Functions
105105
from an exception object). The use of negative values is a provisional
106106
detail which may change in the future.
107107

108+
.. function:: inet_ntop(af, bin_addr)
109+
110+
Convert a binary network address *bin_addr* of the given address family *af*
111+
to a textual representation::
112+
113+
>>> usocket.inet_ntop(usocket.AF_INET, b"\x7f\0\0\1")
114+
'127.0.0.1'
115+
116+
.. function:: inet_pton(af, txt_addr)
117+
118+
Convert a textual network address *txt_addr* of the given address family *af*
119+
to a binary representation::
120+
121+
>>> usocket.inet_pton(usocket.AF_INET, "1.2.3.4")
122+
b'\x01\x02\x03\x04'
123+
108124
Constants
109125
---------
110126

0 commit comments

Comments
 (0)