1import socket
2
3SOURCE_IP = "192.168.1.123"
4SOURCE_PORT = 5678
5DESTINATION_IP = "192.168.1.124
6DESTINATION_PORT = 5679
7
8# create the socket
9udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
10udp_socket.bind((SOURCE_IP,SOURCE_PORT))
11
12# prepare the payload
13payload_hex_string = "68656c6c6f5f776f726c64" #hello_world
14payload = bytes.fromhex(payload_hex_string)
15
16#send out the packet
17udp_socket.sendto(payload,(DESTINATION_IP,DESTINATION_PORT))