title: Sending binary data over IPC from C to Python
body: <p>I have a C program and a Python program on the same machine.  The C program generates some data in nested structures. What form of IPC is the best way to get this data across to the python program? </p>
  
  <p>Serializing in C (especially nested structures) is a real bear, from what I hear, due to lack of serialization libraries.  I am not very familiar with shared memory, but I assume the formatting of the C structures may not be very palatable to the python program when it comes to memory alignment and following pointers.  The ctype and struct library seems to be for non-nested structures only.  So far, what I am thinking is: </p>
  
  <p>Wrap all the data in the C program into some xml or json format, write it via socket to python program and then let python program interpret the xml/json formatted data.  Looks very cumbersome with lots of overheads. </p>
  
  <p>Any better ideas ? </p>