From dd70640b4c5b2595e25f5951dbd7854392c2485d Mon Sep 17 00:00:00 2001 From: dubost Date: Fri, 10 Jun 2005 09:48:44 +0200 Subject: [PATCH] Des sendall partout LE protocole spcifi darcs-hash:20050610074844-c3cc4-8de5d7781cd2b6c3539cca8aa99064af5b0db98f.gz --- impression/pjl_comm.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/impression/pjl_comm.py b/impression/pjl_comm.py index 382eb648..29986770 100755 --- a/impression/pjl_comm.py +++ b/impression/pjl_comm.py @@ -23,17 +23,17 @@ class hp9500: """Ouvre la connexion vers l'imprimante""" if not self.__douille: - self.__douille = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.__douille = socket.socket(socket.AF_INET, socket.SOCK_STREAM,socket.IPPROTO_TCP) self.__douille.connect((self.hostname, self.port)) #delai d'attente pour la réception des données self.__douille.settimeout(30) - self.__douille.send(self.UEL+"@PJL\n") + self.__douille.sendall(self.UEL+"@PJL\n") def cx_close(self): """Ferme la connexion vers l'imprimante""" if self.__douille: - self.__douille.send(self.UEL+"\n") + self.__douille.sendall(self.UEL+"\n") self.__douille.close() self.__douille=None @@ -51,7 +51,7 @@ class hp9500: command=str(command) command="@PJL " + command + "\n" - self.__douille.send(command) + self.__douille.sendall(command) #debug print command @@ -91,7 +91,7 @@ class hp9500: return "ERREUR : la connexion vers l'imprimante n'est pas ouverte" fichier=open(filename) - self.__douille.sendall(fichier.read()) + self.__douille.sendall(fichier.read()+"\n@PJL"*1024) fichier.close() def write_postscript(self,filename, name, display): @@ -108,7 +108,7 @@ class hp9500: self.pjl_command('JOB DISPLAY=\"%s\" NAME=\"%s\"' % (display,name)) self.pjl_command('ENTER LANGUAGE = POSTSCRIPT ') self.write_file(filename) - self.__douille.send(self.UEL+"@PJL EOJ NAME=\"%s\"\n" % (name)) + self.__douille.sendall(self.UEL+"@PJL EOJ NAME=\"%s\"\n" % (name)) def __del__(self):