docs/usocket: Minor fixes to grammar of getaddrinfo.

This commit is contained in:
Damien George 2018-06-27 15:18:46 +10:00
parent 735358bcf4
commit 11a7a70a6f
1 changed files with 4 additions and 4 deletions

View File

@ -83,8 +83,8 @@ Functions
Translate the host/port argument into a sequence of 5-tuples that contain all the Translate the host/port argument into a sequence of 5-tuples that contain all the
necessary arguments for creating a socket connected to that service. Arguments necessary arguments for creating a socket connected to that service. Arguments
*af*, *type*, and *proto* (which have the same meaning as for `socket()` function) *af*, *type*, and *proto* (which have the same meaning as for the `socket()` function)
can be used to filter which kind of addresses are returned. If a parameter not can be used to filter which kind of addresses are returned. If a parameter is not
specified or zero, all combinations of addresses can be returned (requiring specified or zero, all combinations of addresses can be returned (requiring
filtering on the user side). filtering on the user side).
@ -95,14 +95,14 @@ Functions
The following example shows how to connect to a given url:: The following example shows how to connect to a given url::
s = usocket.socket() s = usocket.socket()
# This assumes that if "type" is not specified, address for # This assumes that if "type" is not specified, an address for
# SOCK_STREAM will be returned, which may be not true # SOCK_STREAM will be returned, which may be not true
s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1]) s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1])
Recommended use of filtering params:: Recommended use of filtering params::
s = usocket.socket() s = usocket.socket()
# Guaranteedly returns address which can be connect'ed to for # Guaranteed to return an address which can be connect'ed to for
# stream operation. # stream operation.
s.connect(usocket.getaddrinfo('www.micropython.org', 80, 0, SOCK_STREAM)[0][-1]) s.connect(usocket.getaddrinfo('www.micropython.org', 80, 0, SOCK_STREAM)[0][-1])