test.py 387 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/python
  2. import socket
  3. import sys
  4. host = "localhost"
  5. port = 56000
  6. with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
  7. s.connect((host, port))
  8. s1 = None
  9. s2 = None
  10. if sys.version[0] == "2":
  11. s1 = char(42)
  12. s2 = char(255)
  13. else:
  14. s1 = bytes([42])
  15. s2 = bytes([255])
  16. s.sendall(s1)
  17. s.sendall(s2)
  18. print("Done")