Faire un don ! | | style | statistiques | contactez-nous | plan | lettre d'information

Retourner aux forums || Retourner au forum Programmation.python

Programmation.python : un paramètre pour une fonction

Posté par lambda () le 01 mars 2007
def sr1(x,filter=None,iface=None, nofilter=0, *args,**kargs):
"""Send packets at layer 3 and return only the first answer
nofilter: put 1 to avoid use of bpf filters
retry: if positive, how many times to resend unanswered packets
if negative, how many times to retry when no more packets are answered
"""
if not kargs.has_key("timeout"):
kargs["timeout"] = -1
s=conf.L3socket(filter=filter, nofilter=nofilter, iface=iface)
a,b,c=sndrcv(s,x,*args,**kargs)
s.close()
if len(a) > 0:
return a[0][1]
else:
return None

Je ne sais pas comment appeler la fonction sr1 avec l'attribut retry. Le problème se pose quand mon serveur est inactif, le serveur ne répond pas et l'émission de paquet se produit indéfiniment...

--
mail administration is very challenging, too many people get into the business without understanding enough of it .... hotmail best exemple
> Lire le message (1 commentaire, moyenne: 1).  

Cette discussion est archivée, il n'est plus possible de laisser des commentaires.

Note : les commentaires appartiennent à ceux qui les ont postés. Nous n'en sommes pas responsables.

C'est pourtant simple

Posté par Amand Tihon (page perso, ) le 01/03/2007 à 18:03. (lien). Évalué à 1.

Si tu veux lui passer un argument "retry", passe-lui simplement un argument "retry" :)

sr1(truc, machin, retry=42)

Revenir en haut de page || Retourner aux forums || Retourner au forum Programmation.python