blob: c6070652ad4dabf0b5b7054b0d3657d43b98b85e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()
|