0

I'm attempting to send an array over RPC, but I receive "RPC: Can't encode arguments" when the data array becomes to large. Under 10Kb from what I've seen.

This is the line that fails.

xdr_bytes (xdrs, (char **)&objp->data, (uint*)&objp->len, objp->len))

Here's the struct being referenced.

struct dataStruct {
    unsigned int len;
    u_char *data;
};

Is there a way to fix this error, or another way to send arbitrarily large arrays?

  • did you try bool_t xdr_opaque(XDR *xdrs, char *cp, unsigned int cnt) ? – kofemann Dec 03 '12 at 07:50
  • Same result. Turns out it was a problem with the network protocol (UDP) I was using. Searching for references to xdr_opaque did lead me to a section of manpages that did have my answer though! – silenthunter747 Dec 03 '12 at 13:17

1 Answers1

4

After checking manpages for other RPC commands I found this:

"Warning: Using UDP has its shortcomings. Since UDP-based RPC messages can only hold up to 8 Kbytes of encoded data, this transport cannot be used for procedures that take large arguments or return huge results."

I was indeed using UDP, and after switching to TCP messages are sent to the server properly.