#!/usr/bin/python3 # -*- coding: utf-8 -*- import socket server_name = "127.0.0.1" server_port = 12000 # AF_INET specifies IPv4 # SOCK_DRAM specifies UDP client_socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) print("Client is launched") message = "" while message != "done": message = input('\nClient says input lowercase sentence, or "done": ') client_socket.sendto(message.encode(), (server_name, server_port)) modified_message, server_address = client_socket.recvfrom(2048) print("Client says message was from from address: ", server_address) print(f"Client says message received from server was: {modified_message.decode()}") client_socket.close()