Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- server_address = ('127.0.0.1', 5)
- message = input("Enter a message: ").encode()
- client_socket.sendto(message, server_address)
- data, _ = client_socket.recvfrom(1024)
- print(f"Echo from server: {data.decode()}")
- client_socket.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement