circuitpython/tests/extmod/usocket_tcp_basic.py

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

18 lines
394 B
Python
Raw Normal View History

# Test basic, stand-alone TCP socket functionality
try:
import usocket as socket, uerrno as errno
except ImportError:
try:
import socket, errno
except ImportError:
print("SKIP")
raise SystemExit
# recv() on a fresh socket should raise ENOTCONN
s = socket.socket()
try:
s.recv(1)
except OSError as er:
print("ENOTCONN:", er.errno == errno.ENOTCONN)