On Mar 16, 1:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 15 Mar 2008 20:08:05 -0200, <[EMAIL PROTECTED]> escribi�: > > > > > > > On Mar 15, 8:18 am, Bryan Olson <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >> > Newbie question: Can you write to the 'file-like object' a pickle, > >> > and receive it intact-- as one string with nothing else? > > >> Yes, but there's a world of gotcha's. Sockets do not recognize > >> record boundaries, and Python's 'pickle' has holes one's enemies > >> could drive a truck through. Still, you can pickle, write, read, > >> un-pickle, and get back your data intact. > > >> > I want to know because I want to send two pickles. > > >> "Two pickles" sounds like a tasty snack, but also suggests you may > >> be playing hopscotch in a minefield. This is a helpful group. Give > >> us more to go on, and you are likely to receive thousands of > >> dollars worth of consulting for free. > > > It depends on the situation. How generally applicable is this: > > > fun ListenerGeneric( port, factory, arrivedfun ): > > > which calls 'factory' on socketA.accept (and loops again), then > > arrivedfun( stringA ) on message complete detection. ?. It should > > start itself in a separate thread. > > > Or is this any better: > > > for x in connections(): > > startnewthreadwith x: > > for y in messages( x ): > > arrivedfun( y ) > > This looks like a SocketServer + ThreadingMixIn + a RequestHandler (your > factory). > But as B. Olson already pointed, pickles are unsafe. Worse, it's not that > someone could send a specially crafted pickle that could execute some > arbitrary code: you're blindy executing whatever you receive! > xmlrpc may be a good alternative in some cases.
I see. Just transmit a binary and execute that. Make sure to have handles to your program publicly accessible too. I execute this. -- http://mail.python.org/mailman/listinfo/python-list