Advertisement
johnpentyrch

Client1

Jun 7th, 2020
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import socket
  2. client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3. client_socket.connect(("127.0.0.1",8081))
  4. print("Connected")
  5. data=client_socket.recv(1024)
  6. message=data.decode()
  7. print(message)
  8. #Send a message back to the server
  9. message="Have a Great Day"
  10. data=message.encode()
  11. client_socket.send(data)
  12.  
  13. #close socket
  14. client_socket.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement