diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2021-02-19 18:44:27 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-19 18:44:27 -0800 |
| commit | 5d154937d68a29d90d86e45467c4ebc134252855 (patch) | |
| tree | 535bbb96c393b6e722a70febd87c2ad931656aeb /tests/circuitpython-manual/socketpool/server/host-client.py | |
| parent | fdf9d04a75d71f16b5e715ab3240e900ca66f1f8 (diff) | |
| parent | e77981f86e53eb5a985e89e03cc984e5b318da37 (diff) | |
Merge pull request #4187 from hierophect/manual-tests
Create tests/_manual, add Socket tests
Diffstat (limited to 'tests/circuitpython-manual/socketpool/server/host-client.py')
| -rw-r--r-- | tests/circuitpython-manual/socketpool/server/host-client.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/circuitpython-manual/socketpool/server/host-client.py b/tests/circuitpython-manual/socketpool/server/host-client.py new file mode 100644 index 000000000..b482755d8 --- /dev/null +++ b/tests/circuitpython-manual/socketpool/server/host-client.py @@ -0,0 +1,17 @@ +import socket + +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) + + print("Connecting") + s.connect((HOST, PORT)) + + print("Sending") + s.send(b'Hello, world') + + print("Receiving") + data = s.recv(1024) + print('Received', repr(data)) |
