from threading import Thread
import socket
import time
class MyThread(Thread):
def run(self):
#verifica que exista la pagina
conexion = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
conexion.connect((Ip,Puerto))
conexion.close()
try:
l = 1
while True:
conexion = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
conexion.connect((Ip,Puerto))
conexion.close()
print(l)
l = l+1
except IOError:
print("error")
Ip = input("Ip:")
#default 80
Puerto = int(input("Puerto: "))
NoThread = int(input("Numero de Hilos: "))
for i in range(NoThread):
my_thread = MyThread()
print("Hilo Activo: ")
print("Tempo de Espera en Cada Hilo: 1\n")
time.sleep(1)
my_thread.name = i
my_thread.start()
No hay comentarios:
Publicar un comentario