title: What is the recommended way of encoding/decoding XDR types in erlang?
body: <p>In another SO discussion, we were talking about interfacing an erlang application to another non-erlang app that is using <a href="http://en.wikipedia.org/wiki/External_Data_Representation" rel="nofollow noreferrer">XDR encoded packets for network communications</a>. </p>
  
  <p>Unfortunately, I couldn't really find any real pointers on dealing with XDR data using erlang.</p>
  
  <p>So what is the recommended way of dealing with XDR encoded data in erlang?</p>
  
  <p>Thanks</p>
  
  <p>PS: So far, I could find the following resources:</p>
  
  <ul>
  <li><p><a href="http://www.erlang.se/workshop/2002/Armstrong.pdf" rel="nofollow noreferrer">Getting Erlang to talk to the outside world</a> (2002, PDF, only mentions XDR shortly)</p></li>
  <li><p><a href="http://www.jetcafe.org/~npc/doc/euc00-sendmail.html" rel="nofollow noreferrer">Sendmail Meets Erlang: Experiences Using Erlang for Email Applications</a> (2000, also nothing relevant in here, but still an interesting read)</p></li>
  <li><p><a href="http://erlang.org/pipermail/erlang-questions/2000-August/001543.html" rel="nofollow noreferrer">And then there's this posting</a>, which is relevant and provides some XDR routines, but is from 08/2000, and so even predates erlang's support for the bits syntax.</p></li>
  </ul>