1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env python3 import socket s = socket.create_connection(("localhost", 42424)) stringbuf = "" for i in range(0, 1000): stringbuf = stringbuf + "spam " + str(i) + "\n" buf = stringbuf.encode("utf-8") s.sendall(buf) s.close()