How to write program to do file transfer based on based omniORBpy
- by cofthew7
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?