Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1480 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  parallelisation telnetlib

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

parallelisation telnetlib

n°2052473
anapivirtu​a
Boh.
Posté le 27-01-2011 à 18:24:58  profilanswer
 

Messieurs bonjour je cherche à exécuter en même temps 4 sessions telnetlib mais à priori ce n'est pas possible:


class telnetlib.Telnet([host[, port[, timeout]]])¶
 
    Telnet represents a connection to a Telnet server. The instance is initially not connected by default; the open() method must be used to establish a connection. Alternatively, the host name and optional port number can be passed to the constructor, to, in which case the connection to the server will be established before the constructor returns. The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used).
 
   Do not reopen an already connected instance.


 
Quelqu'un aurait la solution ou une petite idée à me soumettre ?
Voici le morceau qu'il faudrait que je fasse tourner 4x en même temps:
 

tn = telnetlib.Telnet(sys.argv[1])
tn.read_until("Username: " )
tn.write(usr + "\n" )
if pswd:
    tn.read_until("Password: " )
    tn.write(pswd + "\n" )
tn.write(["ping vrf ", sys.argv[2], " ", sys.argv[5], " ", "size 15000 repeat 5000 \n"])


 
Merci d'avance


Message édité par anapivirtua le 27-01-2011 à 18:25:12

---------------
Si vis pacem, para bellum.
mood
Publicité
Posté le 27-01-2011 à 18:24:58  profilanswer
 

n°2052743
masklinn
í dag viðrar vel til loftárása
Posté le 28-01-2011 à 16:42:37  profilanswer
 

Pourquoi tu essaies de faire tourner la même chose 4 fois sur le même serveur telnet?


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°2052823
anapivirtu​a
Boh.
Posté le 28-01-2011 à 22:06:22  profilanswer
 

C'est pour saturer un lien en l’occurrence ! :o


---------------
Si vis pacem, para bellum.
n°2052830
masklinn
í dag viðrar vel til loftárása
Posté le 28-01-2011 à 23:02:04  profilanswer
 

OK. Ben faut utiliser threading et ouvrir chaque connection dans son thread.
 
Alternativement, tu peux utiliser multiprocessing (si Python >= 2.6) et ouvrir chaque connection dans son process, ça aura le même effet.


---------------
Stick a parrot in a Call of Duty lobby, and you're gonna get a racist parrot. — Cody
n°2052838
anapivirtu​a
Boh.
Posté le 29-01-2011 à 00:04:50  profilanswer
 

ok merci :o


---------------
Si vis pacem, para bellum.

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  parallelisation telnetlib

 

Sujets relatifs
qt et parallélisationMPI et parallélisation
parallélisation sur un "cluster"Parallèlisation d'un programme avec MPICH
[JAVA] Parallelisation[VB] gestion des process / parallélisation de procédures
Plus de sujets relatifs à : parallelisation telnetlib


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR