Tu peu faire une classe pour chaque connection et threader une instance à chaque connection, le code serait plus lisible, au niveau des performances je ne sais pas.
Sinon tu peux utiliser les " exception "en python. C'est très utile cela permet de faire remonter les erreurs d'execution et de les gérer.
A deprecated alias of OSError.
Changed in version 3.3: Following PEP 3151, this class was made an alias of OSError.
exception socket.herror
A subclass of OSError, this exception is raised for address-related errors, i.e. for functions that use h_errno in the POSIX C API, including gethostbyname_ex() and gethostbyaddr(). The accompanying value is a pair (h_errno, string) representing an error returned by a library call. h_errno is a numeric value, while string represents the description of h_errno, as returned by the hstrerror() C function.
Changed in version 3.3: This class was made a subclass of OSError.
exception socket.gaierror
A subclass of OSError, this exception is raised for address-related errors by getaddrinfo() and getnameinfo(). The accompanying value is a pair (error, string) representing an error returned by a library call. string represents the description of error, as returned by the gai_strerror() C function. The numeric error value will match one of the EAI_* constants defined in this module.
Changed in version 3.3: This class was made a subclass of OSError.
exception socket.timeout
A subclass of OSError, this exception is raised when a timeout occurs on a socket which has had timeouts enabled via a prior call to settimeout() (or implicitly through setdefaulttimeout()). The accompanying value is a string whose value is currently always "timed out".
s'il exite une version Fr je ne suis pas au courant.
# Classe
Posté par n0wic . En réponse au message client serveur par socket en clientThread. Évalué à -10.
Tu peu faire une classe pour chaque connection et threader une instance à chaque connection, le code serait plus lisible, au niveau des performances je ne sais pas.
Sinon tu peux utiliser les " exception "en python. C'est très utile cela permet de faire remonter les erreurs d'execution et de les gérer.
Ils parlent ici d'un implémentation sur la lib socket :
http://stackoverflow.com/questions/25447803/python-socket-connection-exception
Toutes les erreurs que ton socket peut gérer sont décries dans la doc ici :
https://docs.python.org/3/library/socket.html#socket.error
```exception socket.error
exception socket.herror
exception socket.gaierror
exception socket.timeout