Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26631

Re: Pickle file and send via socket

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader03.nrc01.news.zen.net.uk.POSTED!not-for-mail
From Nobody <nobody@nowhere.com>
Subject Re: Pickle file and send via socket
Date Mon, 06 Aug 2012 17:11:56 +0100
User-Agent Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Message-Id <pan.2012.08.06.16.11.55.540000@nowhere.com>
Newsgroups comp.lang.python
References <f3b73b0e-1520-4768-a1d2-bb754357dfc7@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Lines 15
Organization Zen Internet
NNTP-Posting-Host 6737b8f4.news.zen.co.uk
X-Trace DXC=F6R_UBfgekBI>27fALHYIJf2FgniPJjgB=dR0\ckLKG@WeZ<[7LZNRFQ249]PgH\SFM2Z^cWRFGAK7URI][?AHVJ
X-Complaints-To abuse@zen.co.uk
Xref csiph.com comp.lang.python:26631

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Pickle file and send via socket "S.B" <hyperboogie@gmail.com> - 2012-08-06 06:32 -0700
  Re: Pickle file and send via socket Nobody <nobody@nowhere.com> - 2012-08-06 17:11 +0100
  Re: Pickle file and send via socket Christian Heimes <lists@cheimes.de> - 2012-08-06 18:45 +0200
  Re: Pickle file and send via socket Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-06 15:26 -0400
  Re: Pickle file and send via socket "S.B" <hyperboogie@gmail.com> - 2012-08-07 04:21 -0700
    Re: Pickle file and send via socket lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 14:07 +0100
  Re: Pickle file and send via socket lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 13:48 +0100
    Re: Pickle file and send via socket "S.B" <hyperboogie@gmail.com> - 2012-08-08 06:50 -0700
      Re: Pickle file and send via socket lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 16:07 +0100

csiph-web