client.py 459 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter tcp
  5. name:client.py
  6. author:rabin
  7. """
  8. import socket
  9. import time
  10. HOST = '0.0.0.0' # The remote host
  11. PORT = 8000 # The same port as used by the server
  12. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  13. s.connect((HOST, PORT))
  14. s.sendall('Hello, \nw')
  15. time.sleep(5)
  16. s.sendall('ord! \n')
  17. data = s.recv(1024)
  18. print 'Received', repr(data)
  19. time.sleep(60)
  20. s.close()