#!/usr/bin/python3 #Bertrand Vandeportaele 2019 #https://pymotw.com/2/socket/udp.html import socket import sys # Create a UDP socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #server_address = ('localhost', 10000) #esp8266 via AP thomson server_address = ('192.168.1.65', 10000) message = 'This is the message.' try: # Send data print ('sending "%s"' % message) sent = sock.sendto(message.encode(), server_address) finally: print ( 'closing socket') sock.close()