diff options
| author | Jeff Epler <jeff@adafruit.com> | 2021-03-15 13:50:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-15 13:50:49 -0500 |
| commit | 05ed179e11599dd45a76dfb14ecf624d0ff96d68 (patch) | |
| tree | a046c6d1f117814168150484ed1bf7840d3400d7 /tests/circuitpython-manual/socketpool/server | |
| parent | 3cbff45f9aac5ea2855bbc888083d356a91c80fe (diff) | |
| parent | f9b4189b4c640823dabb76de8effd2a836da2eb0 (diff) | |
Merge pull request #4362 from microDev1/code-formatting
Add code formatting and translations check
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)) |
