Files
tcp_client_tests/tcp_client_split_call.py
armand 1960eb632b add : split request
added the version of the code that sends the request in split and times it
2025-09-25 15:35:33 +02:00

24 lines
437 B
Python

#!/usr/bin/env python
import socket
tcp_server_adress = "my_tcp_server.fr"
client_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('{tcp_server_adress}', 80))
request = f"GET / HTTP/1.1\r\n"
request = f"Host: {tcp_server_adress}\r\n\r\n"
sock.sendall(request.encode())
buffer = b""
while True:
data = sock.recv(4096)
if not data:
break
buffer += data
print(buffer.decode())
sock.close()