Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import thread
- from socket import *
- serverHost = 'localhost'
- serverPort = 64424
- def doConnection(x):
- s = socket(AF_INET, SOCK_STREAM);
- try:
- s.connect((serverHost, serverPort))
- except:
- return
- s.send('Hello world')
- sys.stdout.flush()
- connectCount = int(sys.argv[1])
- for i in range(connectCount):
- thread.start_new_thread(doConnection, (2,))
- print i
Add Comment
Please, Sign In to add comment