Created
August 18, 2020 21:24
-
-
Save leeyoungseok/bc9a90dd28074d62e7455e87fdbdc84d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
UDP_IP = "127.0.0.1" | |
UDP_PORT = 5005 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind((UDP_IP, UDP_PORT)) | |
while True: | |
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes | |
print("received message:", data, " from ", addr) | |
sock.sendto(data, addr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment