How to write program to do file transfer based on based omniORBpy

Posted by cofthew7 on Stack Overflow See other posts from Stack Overflow or by cofthew7
Published on 2012-12-11T17:01:42Z Indexed on 2012/12/11 17:03 UTC
Read the original article Hit count: 333

Filed under:
|
|

I'm now writing a Corba project to do file transfering between client and server. But I face trouble when I want to upload file from the client to the server.

The IDL I defined is:

interface SecretMessage
{
    string send_file(in string file_name, in string file_obj);
};

And I implemented the uploading function in the client code:

f = open('SB.docx', 'rb')
data = ''
for piece in read_in_chunks(f):
data += piece

result = mo.send_file('2.docx', data)

If the file is a plain txt file, there is no problem. But if the file is a, like jpg, doc, or others except txt, then it does work. It gives me the error:

omniORB.CORBA.BAD_PARAM: CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_NO)

Where is the problem?

© Stack Overflow or respective owner

Related posts about python

Related posts about corba