Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- udp_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- udp_server.bind(("0.0.0.0", 20001))
- #now get message from client
- data, client_address = udp_server.recvfrom(1024)
- #send same message back
- udp_server.sendto(data, client_address)
- #decode and print message
- message=data.decode()
- print(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement