Pickle file and send via socket

S.B hyperboogie at gmail.com
Wed Aug 8 09:50:40 EDT 2012


On Wednesday, August 8, 2012 3:48:43 PM UTC+3, lipska the kat wrote:
> On 06/08/12 14:32, S.B wrote:
> 
> > Hello friends
> 
> >
> 
> > Does anyone know if it's possible to pickle and un-pickle a file across a network socket. i.e:
> 
> > First host pickles a file object and writes the pickled file object to a client socket.
> 
> > Second host reads the pickled file object from the server socket and un-pickles it.
> 
> >
> 
> > Can anyone provide a simple code example of the client and server sides?
> 
> >
> 
> > Thanks
> 
> >
> 
> 
> 
> Hi
> 
> 
> 
> Firstly I am a raw beginner at Python and I don't publish this code
> 
> as a good example of anything. It works for me on Ubuntu Linux 12.04 and 
> 
> Python3.2
> 
> 
> 
> As usual I welcome constructive comments but I will be working on this 
> 
> more to help me understand exactly what is going on
> 
> 
> 
> http://pastebin.com/iFzK7fuk SpaceTravellers.py
> 
> http://pastebin.com/TdqPwMGi NetworkPickler.py
> 
> http://pastebin.com/DF5DtYRZ NetworkUnpickler.py
> 
> 
> 
> lipska
> 
> 
> 
> -- 
> 
> Lipska the Kat: Troll hunter, sandbox destroyer
> 
> and farscape dreamer of Aeryn Sun

Thank you so much !
The examples are very helpful. 
What happens if I have a regular text file I want to send via the network.
Do I need to read the file and then dump it into the "stargate" file object?



More information about the Python-list mailing list