[omniORB] omiORBpy, pickles and strings

Gary Pennington Gary.Pennington@uk.sun.com
Tue, 03 Oct 2000 17:32:27 +0100


Hi,

I have to return an arbitrarily long stream of bytes to a client. (The
bytes actually represent a pickled object, with the pickle having been
stored in a Python string.)

I can't just return a string, since the string may contain NULL values
and language mappings for all languages don't allow NULLS in strings out
of respect to C/C++. So instead, I shall declare the data to be a
sequence of octets ( or should I declare it some other way?).

The problem is that at the client side I have to re-assemble this data
into a string, and this is painfully slow - too slow to be acceptable.
However, in fact if my client is a cPython client, I don't have to do
this re-assembly, however if it is a jPython client I do.

This is a bit annoying since it is inconsistent, so before I start
putting in the time to handle this differently-  I have 3 questions.

1. Is there a better way to pass a pickled representation from a server
to a client than I describe?
2. If I have an interface that declares the following :-

  typedef sequence<octet> octetSeq;
  Blah blah blah...
  octetSeq getState(in UserIF agent);

Why do I get a string in a cPython client, whereas jPython behaves
correctly and delivers up a pyArray of ints?

3. Should I be declaring my interface to return Any and casting down on
the client end to a string?

Further info, I am being naughty on the server and actually returning a
string. Is this why it appears as a string at the cPython client? If so,
why don't I also get a string at the jPython client and why isn't the
error trapped on the server when I try to return the string? The jPython
client is using stubs generated from the idlj compiler which is
distributed as standard with JDK1.3.

Gary