diff options
| author | DavePutz <dwputz@gmail.com> | 2021-02-24 10:09:52 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-24 10:09:52 -0600 |
| commit | eeb89a97b4a8fa25fb38e4a5d5db78c0c3df9b15 (patch) | |
| tree | e18ea9f61c7930d1f21d72fb69125a0270558038 /tests/circuitpython-manual/socketpool/client/cpy-client.py | |
| parent | cec921f3747beccff10c2d2dfbc237c305083f62 (diff) | |
| parent | e41137c745af65b6342c7e2d3b09d8930eefedb0 (diff) | |
Merge pull request #41 from adafruit/main
Update from adafruit main
Diffstat (limited to 'tests/circuitpython-manual/socketpool/client/cpy-client.py')
| -rw-r--r-- | tests/circuitpython-manual/socketpool/client/cpy-client.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/circuitpython-manual/socketpool/client/cpy-client.py b/tests/circuitpython-manual/socketpool/client/cpy-client.py new file mode 100644 index 000000000..dcc742c9f --- /dev/null +++ b/tests/circuitpython-manual/socketpool/client/cpy-client.py @@ -0,0 +1,26 @@ +import wifi +import socketpool +import ssl +import time + +TIMEOUT = None +HOST = '192.168.10.179' +PORT = 5000 + +# Connect to wifi +print("Connecting to wifi") +wifi.radio.connect("mySSID", "myPASS") +pool = socketpool.SocketPool(wifi.radio) + +print("Creating Socket") +with pool.socket(pool.AF_INET, pool.SOCK_STREAM) as s: + s.settimeout(TIMEOUT) + + print("Connecting") + s.connect((HOST, PORT)) + print("Sending") + sent = s.send(b'Hello, world') + print("Receiving") + buff = bytearray(128) + numbytes = s.recv_into(buff) +print(repr(buff)) |
