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)
- client_socket.connect(("127.0.0.1",20001))
- print("Connected")
- #Send a message to the server
- message="Have a Great Day"
- data=message.encode()
- client_socket.send(data)
- #readmessage back from server
- data=client_socket.recv(1024)
- #now decode and print it
- message=data.decode()
- print(message)
- #close socket
- client_socket.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement