summaryrefslogtreecommitdiff
path: root/tests/circuitpython-manual/socketpool/client/readme.md
diff options
context:
space:
mode:
Diffstat (limited to 'tests/circuitpython-manual/socketpool/client/readme.md')
-rw-r--r--tests/circuitpython-manual/socketpool/client/readme.md46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/circuitpython-manual/socketpool/client/readme.md b/tests/circuitpython-manual/socketpool/client/readme.md
new file mode 100644
index 000000000..45cdf23c8
--- /dev/null
+++ b/tests/circuitpython-manual/socketpool/client/readme.md
@@ -0,0 +1,46 @@
+# Circuitpython as Client
+
+This example demonstrates the use of Socket as a client, accessing a server on a host development machine. This Circuitpython sketch uses the Connect, Send, and Recv_Into methods.
+
+## Prerequisites
+
+Circuitpython V6.2.0 minimum. Neither the host or client sketch has installed module prerequisites.
+
+## Setup
+
+Find a viable IP address for the host machine first and insert it in both sketches as HOST. On mac, this can be done by going to System Preferences/Network and checking the IP address used to connect to the local wireless network. Make sure that both devices are using the same WIFI!
+
+Each sketch can have Timeout values changed. The host sketch usually needs a value above 0, or the recv() will fail. Currently, Circuitpython's Connect function is always blocking, so changing the client timeout will not cause much change in behavior.
+
+Start the Server on the host PC first, within this folder:
+
+```
+python host-server.py
+```
+
+Then, reload the client sketch in Circuitpython.
+
+## Expected Behavior
+
+The example should connect to a server running on the host machine. The client will send a "Hello world" string to the server, which will return it.
+
+Expected client output:
+
+```
+Connecting to wifi
+Creating Socket
+Connecting
+Sending
+Receiving
+bytearray(b'Hello, world')
+```
+
+Expected Server output (IP/port values will vary):
+
+```
+Create Socket
+Accepting connections
+Connected by ('192.168.10.128', 64509)
+got: b'Hello, world'
+sent: b'Hello, world'
+```