I've been searching about this question, but i couldn't understand the question since it was not really general, I wouldn't find the solution to read UDP packets that contain UTF-8 text for example.
So i make a socket, that makes a UDP packet that contains UTF-8 text, and i send it like this:
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 80
MESSAGE = "Hello, World!"
sock = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
Lets define this as sender.py.
Now i want to make a reciever.py script that will be executed after sender.py.
How can i make that? I've heard of Data, addr = udp.recvfrom(1024) but i'm not entirely sure how it works/how to use it.
So whenever i execute them together, Reciever.py can print UTF-8 text of UDP packet sent.