<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Per esperienza ti consiglio di usare scapy che č un mostro per la gestione client/server per i protocolli + diversi.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Gestisci la risposta creando addirittura delle tabelle o semplicemente i campi come pių ti aggrada. <br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>E' tutto implementato in Python e lo importi come un modulo qualunque.</span></div><div
 style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Consigliato per la gestione di comunicazioni tcp/ip.<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Ciiao</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>py.Re<br></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> ----- Messaggio inoltrato -----<br>  <b><span style="font-weight:bold;">Da:</span></b> Matteo Perini <perini.matteo@gmail.com><br> <b><span
 style="font-weight: bold;">A:</span></b> Discussioni generali sul linguaggio Python <python@lists.python.it> <br> <b><span style="font-weight: bold;">Inviato:</span></b> Martedė 21 Agosto 2012 12:47<br> <b><span style="font-weight: bold;">Oggetto:</span></b> [Python] controllare risposta tcp/ip<br> </font> </div> <br>Ciao a tutti,<br>sapete dirmi come fare a controllare la risposta ottenuta durante una comunicazione client-server?<br><br>Cerco di spiegare meglio il mio problema.<br>ho del codice simile a questo:<br><br>s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)<br>s.connect(("192.168.1.102",5001))<br>s.send('comando')<br>resp = s.recv(1024)<br><br><br>dove 1024 dovrebbe essere il numero di caratteri "letti". giusto?<br><br>Quando invio il comando dovrei ottenere una risposta dal server e solitamente č cosė.<br>Il problema č che la risposta resp che ottengo, in qualche caso, appare troncata.<br><br>La risposta deve essere una
 struttura xml tipo questa:<br><server><br>  <var1>TRUE</var1><br>  <var2>TRUE</var2><br>  <var3>FALSE</var3><br>  <var4>TRUE</var4><br>  <var5>FALSE</var5><br>  <var6>55.5</var6><br></server><br><br>Se la struttura non arriva completa non posso fare il parsing dell'xml.<br><br>Come posso controllare che la struttura arrivi completa?<br>Devo controllare le righe iniziale e finale?<br>Devo svuotare in qualche modo il buffer prima di leggere (non dovrebbe essere pieno!)?<br>Leggo troppi caratteri?<br><br>E' un problema che si verifica solo ogni tanto e non riesco a trovarne una causa.<br>Il server č windows il client monta linux.<br><br>Grazie a chiunque mi indichi qualche possibile strategia per evitare questo fastidioso problema.<br>Ciao<br>Buon caldo<br>Matteo<br>_______________________________________________<br>Python mailing list<br><a
 ymailto="mailto:Python@lists.python.it" href="mailto:Python@lists.python.it">Python@lists.python.it</a><br><a href="http://lists.python.it/mailman/listinfo/python" target="_blank">http://lists.python.it/mailman/listinfo/python</a><br><br><br> </div> </div>  </div></body></html>