ICE で Android アプリケーションを作成しました。しかし、アプリケーションを実行すると、「LogCat」は「Ice.ConnectionRefusedException error=0」というメッセージを出力し、長い間検索しましたが、答えがありません。私を助けてください!どうもありがとうございます。これは 2 つのコード セクションです。(下手な英語でごめんなさい)
サーバー (C++)
int status = 0;
Ice::CommunicatorPtr ic;
try
{
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter =
ic->createObjectAdapterWithEndpoints("HelloAdapter", "tcp -p 10000");
Ice::ObjectPtr object = new HelloI();
adapter->add(object, ic->stringToIdentity("hello"));
adapter->activate();
ic->waitForShutdown();
}
クライアント(Java)
public void sethelloPrx(){
Ice.Communicator ic=null;
try{
ic=Ice.Util.initialize();
Ice.ObjectPrx base=
ic.stringToProxy("hello:tcp -h 127.0.0.1 -p 10000");
index = helloPrxHelper.checkedCast(base);
if(index == null)
throw new Error("Invalid proxy");
}catch(Exception e){
Toast.makeText(MainActivity.this,
"IceMain 注册失败",
Toast.LENGTH_SHORT).show();
Log.e("bmi",e.toString());
}
}