summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/usocket_tcp_basic.py
blob: 368dfe3c98f4a41e19b46c9c902d660c8733adf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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.args[0] == errno.ENOTCONN)