[BangPypers] Passing structure

Anand Balachandran Pillai abpillai at gmail.com
Wed Feb 24 20:04:55 CET 2010


On Wed, Feb 24, 2010 at 4:50 PM, Umar Shah <umar43 at gmail.com> wrote:

> Hi,
>
> If you are sending over the network, better use a protocol for such
> communication,
> on python side you can serialize the object into a json or xml string
> and let the server handle the data accordingly.
>

Use the "struct" module for converting a structure from/to string/struct
format. See the documentation of "struct" for details.

For simple usage of struct for this, see the recipe
http://code.activestate.com/recipes/457669/

--Anand


>
> regards,
> umar
>
> On Wed, Feb 24, 2010 at 4:14 PM, Goudar, Girish
> <Girish.Goudar at goodrich.com> wrote:
> > Hi All,
> >
> >
> >
> > I want to pass a structure (which contains int, float, char etc) from a
> > client program written in Python to a server program written in C
> > (Operating system is DEOS). But the "socket.send" command in Python
> > supports only String or Readonly buffer. I want to pass a structure.
> > Could you please help me on this?
> >
> >
> >
> > Thanks and Regards,
> >
> > Girish P.G
> >
> >
> >
> >
> >
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
>
> Ted Turner  - "Sports is like a war without the killing." -
> http://www.brainyquote.com/quotes/authors/t/ted_turner.html
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
--Anand


More information about the BangPypers mailing list