O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

xdrlib

xdrlib is used to encode and decode data in the Sun XDR (External Data Representation) format. XDR is often used as a portable way to encode binary data for use in networked applications. It’s used extensively in applications involving remote procedure calls (RPCs).

Encoding and decoding is controlled through the use of two classes:

Packer()

Creates an object for packing data into an XDR representation.

Unpacker(data)

Creates an object for unpacking XDR-encoded data. data is a string containing XDR-encoded data values.

An instance, p, of the Packer class supports the following methods:

p.get_buffer()

Returns the current pack buffer as a string.

p.reset()

Resets the pack buffer to the empty string.

p.pack_uint(x)

Packs a 32-bit unsigned ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required