And is this really your ESP32s address:Quite often that is the home router address...
Note showing internal IP addresses is secure and they cannot be accessed from outside your network and by using correct addresses it helps diagnose network issues enormously. Could I also ask that you use the code tags (5th from left on the top bar) to keep indentations (vital in some languages):NOTE above is my guess at your indentation and may be wrong.
Code:
SERVER_IP = '192.168.0.1'Note showing internal IP addresses is secure and they cannot be accessed from outside your network and by using correct addresses it helps diagnose network issues enormously. Could I also ask that you use the code tags (5th from left on the top bar) to keep indentations (vital in some languages):
Code:
import socketimport timedef send_data_to_server(server_ip, server_port, data): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: client_socket.connect((server_ip, server_port)) client_socket.sendall(data.encode()) response = client_socket.recv(80) print("Received from ESP32:", response.decode())if __name__ == "__main__": SERVER_IP = '192.168.0.1' # Replace with your ESP32 IP address SERVER_PORT = 80 # The port should match your ESP32 server's port strings_to_send = ["t1", "t2", "t3", "t4", "t5", "t6", "r1"] while True: for data in strings_to_send: print("Sending to ESP32:", data) send_data_to_server(SERVER_IP, SERVER_PORT, data) time.sleep(1) # Wait for a second before sending the next stringStatistics: Posted by MiscBits — Fri Mar 15, 2024 11:42 am