Loesome

Untitled

Jan 23rd, 2021 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import socket
  2.  
  3. SERVER = "127.0.0.1"
  4. PORT = 5000
  5. client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6. client.connect((SERVER, PORT))
  7. client.sendall(bytes("This is from Client", 'UTF-8'))
  8. while True:
  9. in_data = client.recv(1024)
  10. print("From Server :", in_data.decode())
  11. out_data = input()
  12. client.sendall(bytes(out_data, 'UTF-8'))
  13. if out_data == 'bye':
  14. break
  15. client.close()
  16.  
Add Comment
Please, Sign In to add comment