summaryrefslogtreecommitdiff
path: root/tests/circuitpython-manual/socketpool/server/host-client.py
blob: b482755d88747a83ea14c5a181d66423fa3e5748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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))