Commit 0d10e531 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

docs/usocket: Describe address format once at the beginning.

Different ports may have different formats.
parent 92497bff
......@@ -10,6 +10,15 @@ This module provides access to the BSD socket interface.
See corresponding `CPython module <https://docs.python.org/3/library/socket.html>`_ for
comparison.
Socket address format(s)
------------------------
Functions below which expect a network address, accept it in the format of
`(ipv4_address, port)`, where `ipv4_address` is a string with dot-notation numeric
IPv4 address, e.g. ``"8.8.8.8"``, and port is integer port number in the range
1-65535. Note the domain names are not accepted as `ipv4_address`, they should be
resolved first using ``socket.getaddrinfo()``.
Functions
---------
......@@ -85,8 +94,7 @@ Methods
.. method:: socket.bind(address)
Bind the socket to address. The socket must not already be bound. The format of ``address``
is: ``(ipv4 address, port)``
Bind the socket to address. The socket must not already be bound.
.. method:: socket.listen([backlog])
......@@ -104,7 +112,7 @@ Methods
.. method:: socket.connect(address)
Connect to a remote socket at address. The format of address is: ``(ipv4 address, port)``
Connect to a remote socket at address.
.. method:: socket.send(bytes)
......@@ -122,8 +130,7 @@ Methods
.. method:: socket.sendto(bytes, address)
Send data to the socket. The socket should not be connected to a remote socket, since the
destination socket is specified by address. The ``address`` has the same format as the
rest of the methods, see above.
destination socket is specified by `address`.
.. method:: socket.recvfrom(bufsize)
......
Supports Markdown
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