diff options
Diffstat (limited to 'tests/circuitpython-manual/socketpool/server')
| -rw-r--r-- | tests/circuitpython-manual/socketpool/server/cpy-server.py | 10 | ||||
| -rw-r--r-- | tests/circuitpython-manual/socketpool/server/host-client.py | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/circuitpython-manual/socketpool/server/cpy-server.py b/tests/circuitpython-manual/socketpool/server/cpy-server.py index d865156bc..bce1f9d6a 100644 --- a/tests/circuitpython-manual/socketpool/server/cpy-server.py +++ b/tests/circuitpython-manual/socketpool/server/cpy-server.py @@ -11,21 +11,21 @@ pool = socketpool.SocketPool(wifi.radio) print("Finding IP address") print(wifi.radio.ipv4_address) HOST = str(wifi.radio.ipv4_address) -PORT = 80 # Port to listen on +PORT = 80 # Port to listen on print("Creating socket") -sock = pool.socket(pool.AF_INET,pool.SOCK_STREAM) +sock = pool.socket(pool.AF_INET, pool.SOCK_STREAM) sock.bind((HOST, PORT)) sock.listen(1) print("Accepting connections") conn, addr = sock.accept() with conn: - print('Connected by', addr) + print("Connected by", addr) buff = bytearray(128) print("Receiving") numbytes = conn.recvfrom_into(buff) - print(buff[:numbytes[0]]) + print(buff[: numbytes[0]]) if numbytes: print("Sending") - conn.send(buff[:numbytes[0]]) + conn.send(buff[: numbytes[0]]) diff --git a/tests/circuitpython-manual/socketpool/server/host-client.py b/tests/circuitpython-manual/socketpool/server/host-client.py index b482755d8..e2cc77c4e 100644 --- a/tests/circuitpython-manual/socketpool/server/host-client.py +++ b/tests/circuitpython-manual/socketpool/server/host-client.py @@ -1,7 +1,7 @@ import socket -HOST = '192.168.10.128' # The server's hostname or IP address -PORT = 80 # The port used by the server +HOST = "192.168.10.128" # The server's hostname or IP address +PORT = 80 # The port used by the server with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.settimeout(None) @@ -10,8 +10,8 @@ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) print("Sending") - s.send(b'Hello, world') + s.send(b"Hello, world") print("Receiving") data = s.recv(1024) - print('Received', repr(data)) + print("Received", repr(data)) |
