Created
August 18, 2020 21:23
-
-
Save leeyoungseok/4d9ad74d497fe9428e23b55d67ae9b58 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
# coding: utf-8 | |
import socket | |
UDP_IP = "127.0.0.1" | |
UDP_PORT = 5005 | |
server_addr = (UDP_IP, UDP_PORT) | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
while True: | |
message = input("Type the message to send: ") | |
sock.sendto(message.encode(), server_addr) | |
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes | |
print("received message:", data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment