def handle_client(conn, addr, buffer_size):
    print(f"Connected by {addr}")
    conn.sendall(b"Hi there!\n")

    try:
        while True:
            data = conn.recv(buffer_size)
            if not data:
                print("Client disconnected.")
                break
            print("Received:", data.decode())
            # Add custom logic here if needed
    except Exception as e:
        print("Error:", e)
