I'm trying to stress test my EC2 Micro instance using Python.
I'm getting an error which seems self-explanatory but thats not the case:
Error: an integer is required
stress_test function:
try:
bytes = random._urandom(512)
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((self.host, int(self.port)))
s.setblocking(0)
s.sendto(bytes, (self.host, self.port))
except Exception, e:
print(str(e))
main function:
while True:
if threading.activeCount() < thread_limit:
stress_test(host_ip, host_port).start()
The error is on this line: s.sendto(bytes, (self.host, self.port))
However, If I try converting it to init I would of course get an invalid literal for int() with base 10 error.
I have also tried s.sendto(bytes(512), (self.host, self.port)) but then I get 'str' object is not callable error.
What I'm I doing wrong?