|
|
|
|||||
|
retrieve proxy id
Hi there
I was wondering if there is an easy way to retrieve Proxy ids? I am currently toying with the demos supplied with the Ice documentation and would like to do the following. While passing a clientproxy to a list on the server I would like to cout the id (used as username) of the proxy. The clientcode is as follows: Code:
//code omitted
int
CallbackClient::run(int argc, char* argv[])
{
string username;
//Enter Username tryblok begin
try
{
cout << "Enter Username.\n";
cout << "Username: " << flush;
getline(cin, username);
}
catch(const Exception& ex)
{
cerr << ex << endl;
return EXIT_FAILURE;
}
//Enter Username tryblok end
PropertiesPtr properties = communicator()->getProperties();
const char* proxyProperty = "Callback.Client.CallbackServer";
std::string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
cerr << appName() << ": property `" << proxyProperty << "' not set" << endl;
return EXIT_FAILURE;
}
CallbackSenderPrx server = CallbackSenderPrx::checkedCast(communicator()->stringToProxy(proxy));
if(!server)
{
cerr << appName() << ": invalid proxy" << endl;
return EXIT_FAILURE;
}
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client");
Identity ident;
ident.name = username;
ident.category = "";
CallbackReceiverPrx somevarname = CallbackReceiverPrx::uncheckedCast(adapter->add(new CallbackReceiverI, ident));
adapter->activate();
server->ice_connection()->setAdapter(adapter);
server->addClient(somevarname);
//code omitted
Code:
void
CallbackSenderI::addClient(const CallbackReceiverPrx& proxy, const Current& current)
{
//pseudocode begin:
// cout the username providet as identon the clientside:
//CallbackReceiverPrx somevarname = CallbackReceiverPrx::uncheckedCast(adapter->add(new CallbackReceiverI, ident));
//pseudocode end
_clients.push_back(proxy);
}
|
|
||||||
|
For support please fill out your signature information as described in this post Important note: Change in support policy
|
|
|||||
|
hi,steepLearningC,
It seemed that you made some mistakes when using bi-dir connection. The ice document (page 916 , version 3.0.0)has given very detailed explanations about this. please refer to it. You can get the identity via ice_getIdentity(), but you can't print it with cout << "My proxy: " << prx << endl since in your bi-dir case the proxy is a type of "fixed" ,which doesn't support unmarshalling. I think Benard must overlook some lines of you codes .Cheers OrNot
__________________
Looking for the nails with my favorite hammer, ICE. ------------------------------------------- Huo.Fei GE Healthcare Bin.Li@ge.com -------------------------------------------- |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ptr to Proxy w/o identity? | bboerner | Help Center | 5 | 10-07-2005 11:39 AM |
| Ice Proxy Design | jghickman | Help Center | 7 | 07-29-2005 09:00 PM |
| SSL Proxy Endpoint and -s | gsalazar | Help Center | 11 | 06-22-2005 02:57 PM |
| Getting a description of proxy | Nis Baggesen | Help Center | 2 | 06-01-2005 09:03 AM |
| Proxy to 127.0.0.1 | Nis Baggesen | Help Center | 3 | 02-16-2005 05:04 PM |