Python XDR TCP stream

438 Views Asked by At

I have a C socket server who receive XDR data. I have wrote a C and a Java client. I am trying to write a Python client using xdrlib.

import xdrlib

p = xdrlib.Packer()
p.pack_int(5) 
p.pack_int(4)
p.pack_int(3)
data = p.get_buffer()

When i decode this via the server data are different. This is because data are encoded as to be read via a xdrmem decoder. (they do not have start and end of record).

Does anyone know if there is a library for python who support the creation of xdr records? In c this is done via xdrrec_create and in Java this is called XdrTcpEncodingStream.

1

There are 1 best solutions below

2
Venkata Vamsy On

I mostly see xdrlib is the package mostly used. When you have processes that can be done in C or Java, You can just run them in c/java and use it in python by using and interface created by Swig. Let me know if my understanding doesn't suit the scenario.