summaryrefslogtreecommitdiff
path: root/python/sockets/client.py
diff options
context:
space:
mode:
authorpants <niklasjo2004@gmail.com>2026-09-21 14:17:45 -0700
committerpants <niklasjo2004@gmail.com>2026-09-21 14:17:45 -0700
commita33d49ac4d1ce554c72770927957a089b4023bf1 (patch)
tree17ea036b5a0e8b488dc236f0ce48a275ecd80ef8 /python/sockets/client.py
Diffstat (limited to 'python/sockets/client.py')
-rw-r--r--python/sockets/client.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/sockets/client.py b/python/sockets/client.py
new file mode 100644
index 0000000..c607065
--- /dev/null
+++ b/python/sockets/client.py
@@ -0,0 +1,21 @@
+import socket
+
+# Create a socket object
+client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
+# Define the host and port to connect to
+host = '10.100.54.10'
+port = 8000
+
+# Connect to the server
+client_socket.connect((host, port))
+
+# Send data to the server
+client_socket.sendall("Hello from the client!".encode())
+
+# Receive a response from the server
+response = client_socket.recv(1024)
+print("Response from server:", response.decode())
+
+# Close the connection
+client_socket.close()