2020-08-29 23:20:51 -04:00
|
|
|
# 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:
|
2021-04-22 05:32:21 -04:00
|
|
|
print("ENOTCONN:", er.errno == errno.ENOTCONN)
|