Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/net_hosted/accept_nonblock.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
283 B
Python
Raw Normal View History

tests/net_inet: Add tests for accept and connect in nonblocking mode. Some of these tests don't require an Internet connection, but here is a good place to put them for now.
2017-06-21 12:25:10 +10:00
# test that socket.accept() on a non-blocking socket raises EAGAIN
tests: Replace umodule with module everywhere. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 16:57:45 +10:00
import socket
tests/net_inet: Add tests for accept and connect in nonblocking mode. Some of these tests don't require an Internet connection, but here is a good place to put them for now.
2017-06-21 12:25:10 +10:00
s = socket.socket()
s.bind(socket.getaddrinfo("127.0.0.1", 8123)[0][-1])
s.setblocking(False)
s.listen(1)
try:
s.accept()
except OSError as er:
tests: Use .errno instead of .args[0] for OSError exceptions. Signed-off-by: Damien George <damien@micropython.org>
2021-04-22 19:32:21 +10:00
print(er.errno == 11) # 11 is EAGAIN
tests/net_inet: Add tests for accept and connect in nonblocking mode. Some of these tests don't require an Internet connection, but here is a good place to put them for now.
2017-06-21 12:25:10 +10:00
s.close()
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 139ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API