# tcp_client.py - client TCP nho nhat: ket noi, gui mot dong chu, doc tra loi.
import socket

with socket.create_connection(("127.0.0.1", 9001), timeout=5) as conn:   # doi IP thanh IP may server
    conn.sendall("Xin chao tu client".encode("utf-8"))
    print("Tra loi:", conn.recv(1024).decode("utf-8", errors="replace"))
