On Jun 2, 10:29 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote: > En Wed, 03 Jun 2009 01:54:02 -0300, <thebiggestbangthe...@gmail.com> > escribió: > > > I am a python newbie. I am now progressing to writing a > > network app in python to learn more about it. [...] > > Surprisingly, the sha1 hash of the encrypted data before it is sent > > from server is different from the encrypted file data received by the > > client. > > data = connection.recv(10000000) # receive up to 10000000 > > bytes > > recv returns *up* *to* 10000000 bytes: maybe only one byte. > You'll have to keep recv'ing the pieces until you get an empty string > (when client closes the connection), or send the file size first and then > the actual data. > > > buf = open(currentpath+'received-container.tar.gz', 'w') > > buf.write(info) > > buf.close() > > If you're on Linux it doesn't matter, but the 'w' above should be 'wb' for > a binary file. > > > def send_to_sender(cipher, servername): > > ... > > clientSocket.send(cipher) > > Similar to recv above: send() might not send the whole string at once (try > sendall instead). > > -- > Gabriel Genellina
Thanks! :-) very helpful -- http://mail.python.org/mailman/listinfo/python-list