On Mon, 06 Aug 2012 06:32:13 -0700, S.B wrote:

> 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.

Yes, provided that the socket is a stream socket (e.g. TCP, Unix), not a
datagram socket (e.g. UDP).

> Can anyone provide a simple code example of the client and server sides?

Pickling via a socket is no different to pickling via a file. For a
socket, the .makefile() method will return a suitable file object.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to