i write an AMI method in slice file. then i need a python client. so i do all this according to the manual, chapter 29.3.
interface Work{
["AMI"] int write(...);
}
there is a 'proxy' in the main program, and i need this proxy in my ice_responce method in class AMI_Work_writeI. (further more, i use 'sleep' in 'main' for the latency of response)
then the problem occurs, the prx->xyz(...) in my ice_response() can not work correctly. but i can see that the method xyz() is invoked, but a 'print' method after this line can not work. whether the control of the program return to 'main' when the prx->xyz(...) is invoked in ice_response()? maybe something have to do with threading?
Code:
_worker_prx = None
class AMI_Work_writeI(object):
def __init__(self, ...):
...
def ice_response(self, ...):
global _worker_prx
r = _worker_prx->xyz(...) // this line invoke xyz() in the server,i can see it in the server's log
print r // i can not see the output
...
def ice_exception(self,...):
...
__main__
global _worker_prx
properties = Ice.createProperties()
properties.load(config_file)
init_data = Ice.InitializationData()
init_data.properties = properties
worker = properties.getProperty("workerAddress")
base = _communicator.stringToProxy(worker)
_worker_prx = ...
_worker_prx->f(...)
cb = AMI_Worker_writeI(...)
_worker_prx->write_async(cb,...)
...
import time
time.sleep(10)
...