import socket
# Replace 'localhost' with the target host
target_host = 'localhost'
target_port = 9999
# Create a socket object
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the client
client.connect((target_host, target_port))
# Send some data
client.send('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n')
# Receive some data (optional)
response = client.recv(4096)
# Close the connection
client.close()
# Replace 'localhost' with the target host
target_host = 'localhost'
target_port = 9999
# Create a socket object
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the client
client.connect((target_host, target_port))
# Send some data
client.send('GET / HTTP/1.1\r\nHost: localhost\r\n\r\n')
# Receive some data (optional)
response = client.recv(4096)
# Close the connection
client.close()