Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-19-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Question How to use ADAPTER more efficiently?

Hi.

We want to supply a number of services by several processes running on one PC server. And every process we create has to occupy a port when we "createObjectAdapter".

We wonder how to user adapter more efficiently? Can we make an adapter shared by several processes? But we cannot find the function to retrieve the existing adapter. Retrieve adapter by its name? Or there are reasons for what processes cannot share an adapter?

Very thanks for your help
Reply With Quote
  #2 (permalink)  
Old 03-19-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
An adapter has one or more endpoints. One of the standard and most used communication endpoints with Ice is a TCP/IP endpoint. Several processes cannot share a port, that's a fundamental limitation of TCP/IP.

An alternative would be to bundle all your services into the same process. You might want to look at IceBox to provide you with a convenient infrastructure for this.
Reply With Quote
  #3 (permalink)  
Old 03-20-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Smile

Thank you for reply.

And I also want to know whether there is a way to retrieve an existing adapter by its name or identity or something else?
Maybe it cannot be true, but if I does not use a variant to store the adapter after I create it, how can I retrieve it?

Another question is that when I "createObjectAdapterWithRouter", there is no definite endpoint. I have tried to get proxy of a service supplied by that adapter with the IP and port of Router, but it didn't work.
So the problem is: If the Adapter created by Router does not send proxies of its servants actively, how can clients request for services?

Thanks again.
Reply With Quote
  #4 (permalink)  
Old 03-20-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
Once created there is no way to retrieve an adapter from the communicator. You have to remember it. Within a dispatched method on a servant you can get the current adapter from the Ice::Current parameter.

With respect to routed endpoints I'm not really sure what you mean. Could you give a concrete example of the problem?
Reply With Quote
  #5 (permalink)  
Old 03-20-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Smile

Just like these codes:
//////
Glacier2::RouterPrx _router
= Glacier2::RouterPrx::checkedCast(_ComPtr->stringToProxy(strAddress));
_router->createSession(name, pwd);

_adapter = _ComPtr->createObjectAdapterWithRouter("Adapter", router);
ObjectPrx _objPrx = _adapter->add(new Object, id);
//////

If server do not send _objPrx to clients, how can clients get it?
We have tried to request ObjectPrx remotely using 'strAddress' and 'id', but it seemed not to work properly.

Thank you.
Reply With Quote
  #6 (permalink)  
Old 03-21-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
Ok, while I think you could in theory construct the string proxy in the server backend to call to a glacier2 connected client I think its very impractical to do so, as the category field of the object-id changes on a per-session basis.

Specifically in this case I suspect you have not done the following correctly:
- Added the session category to the object identity. You must call router->getCategoryForClient() to get the session specific category.
- You must use the glacier2 router server-side endpoints, not the client-side endpoints. You must use the contents of the Glacier2.Server.Endpoints, not Glacier2.Client.Endpoints.
Reply With Quote
  #7 (permalink)  
Old 03-23-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Smile

Problems come out without an end while project goes on ...

I have an interface below:
//////
interface Subscription
{
bool Login(string Account);
void Logout(string Account);
};
//////

I use it to publish an topic:
//////
IceStorm::TopicPrx _topicPrx;
ObjectPrx _publisherPrx;
try
{
_topicPrx = g_App.m_TopicMngPrx->retrieve(TopicName);
_publisherPrx = _topicPrx->getPublisher()->ice_oneway();
}
catch (const IceStorm::NoSuchTopic&)
{
try
{
_topicPrx = g_App.m_TopicMngPrx->create(TopicName);
_publisherPrx = _topicPrx->getPublisher()->ice_oneway();
}
}
SubscriptionPrx m_SubPrx = SubscriptionPrx::uncheckedCast(_publisherPrx);
m_SubPrx->Logout(strAccount);
m_SubPrx->Login(strAccount);
//////

The result is: Logout succeeded, but Login failed.
Error is :"Ice::TwowayOnlyException"
I think they should be okay even if there are no subscriber. But why one passed while the other failed?

Thanks a lot for your patient
Reply With Quote
  #8 (permalink)  
Old 03-23-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
The exception is as it says... you cannot call methods that return results with a oneway proxy. Specifically, in your case you are trying to call "bool Login(string Account);" with a oneway proxy.

To further compound the problem you cannot change the proxy to a twoway proxy, since you may only call oneway semantic methods (ie: no return values, or exceptions) through IceStorm. If you really need a response model then you either should not use IceStorm, or return the response to your client through some other mechanism such as an IceStorm back-channel, or another interface/proxy.

For example, something like:

Code:
interface LoginCallback
{
   void loggedIn(string account);
};

interface Subscription
{
void Login(string Account, LoginCallback* cb);
void Logout(string Account);
};
Reply With Quote
  #9 (permalink)  
Old 03-24-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Unhappy

I am so sorry... I have noticed that when I read documents. But so many details are forgotten or even ignored...

Thank you for your patient again.
Reply With Quote
  #10 (permalink)  
Old 04-01-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Question

I wonder whether it is proper to continue proposing my questions in this thread. But I don't think it is worth posting a new thread. So as below:

//////
Context ctx
ctx["test"] = "test";
_objPrx = _objPrx->ice_context(ctx);
//////

I use above codes to update the Context of a proxy.
If I use _objPrx to invoke some functions, the server will get context from the special parameter "current".

But once I send this updated proxy as a parameter to another servant, I find the context is lost. Why?
And can we keep the context in a proxy?

I want my server to update the proxies and send them to clients, so clients do not need to update proxies by themselves.

Thanks a lot to Matthew.
Reply With Quote
  #11 (permalink)  
Old 04-02-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
The context is part of the local proxy data, and so does not follow the proxy over the wire. See my article "Proxies" in issue 23 for details http://www.zeroc.com/newsletter/issue23.pdf
Reply With Quote
  #12 (permalink)  
Old 04-02-2008
arlmarse arlmarse is offline
Registered User
 
Name: Raymond Belmont
Organization: XiaMen University, China P.R.
Project: Unified VAS Service Platform
 
Join Date: Mar 2008
Posts: 7
Unhappy

Finally, pre-proxy contexts permit context information to be passed by
through intermediate parts of a system without cooperation of those intermediate parts. For example, suppose you set a per-proxy context on a proxy and then pass that proxy to another system component. When that component uses the proxy to invoke an operation, the per-proxy context will still be sent. In other words, perproxy contexts allow you to transparently propagate information via intermediaries that are ignorant of the presence of any context.

I copy this paragraph from User Manual 3.2.1 in 919 Page "32.11 The Ice::Context Parameter".
I used to think it is possible to keep context in proxies. Would you please explain these words for me? Thank you very much.
Reply With Quote
  #13 (permalink)  
Old 04-02-2008
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 907
Quote:
Originally Posted by arlmarse View Post
I used to think it is possible to keep context in proxies. Would you please explain these words for me? Thank you very much.
"System component" means some other part of your program, not some other, remote Ice server. If you set a context on a proxy and send the proxy over the wire, the context set on that proxy is *not* marshaled. In other words, contexts are ephemeral things that are local to a process, and are not intrinsically part of a proxy. If you stringify a proxy or transmit the proxy as a parameter of an invocation, any per-proxy context is lost.

I will clarify this in the manual--thanks for pointing this out.

Cheers,

Michi.
Reply With Quote
  #14 (permalink)  
Old 04-08-2008
leo leo is offline
Registered User
 
Name: leo wang
Organization: SuperMap.inc
Project: DGIS
 
Join Date: Mar 2008
Posts: 23
Quote:
Originally Posted by matthew View Post
Ok, while I think you could in theory construct the string proxy in the server backend to call to a glacier2 connected client I think its very impractical to do so, as the category field of the object-id changes on a per-session basis.

Specifically in this case I suspect you have not done the following correctly:
- Added the session category to the object identity. You must call router->getCategoryForClient() to get the session specific category.
- You must use the glacier2 router server-side endpoints, not the client-side endpoints. You must use the contents of the Glacier2.Server.Endpoints, not Glacier2.Client.Endpoints.

I have the same doubt!

how to call ice-object which live in the router-adapter from another program which run at the same computer?
the question for the cause of I can't know the router-adapter ports-settings.
Reply With Quote
  #15 (permalink)  
Old 04-08-2008
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
I'm sorry, I don't understand your question. Here is a typical setup:

Code:
Client <- C1 -> Router/Glacier2 --  C2 -> Server(s)
                               <- C3  --
Normally the Client, Glacier2 & the backend servers(s) all run on separate machines. The client talks to Glacier2 through a connection. If the client supports callback objects this connection will be bi-directional (in this case C1). Glacier2 talks with the server over connection C2. If the server(s) call back on the client then the, the server will use a separate connection, C3.

What exactly is the case you are talking about?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to know which port the adapter is using? nyingchi Help Center 7 07-07-2008 04:29 PM
Adapter Factories zhi Help Center 4 01-22-2007 08:46 PM
How to tell (in C++) when an adapter is deactivated mefoster Help Center 8 10-06-2006 10:24 AM
one adapter or many shimrod Help Center 2 11-07-2005 07:56 AM
Adapter Reactivation Mr.Freeze Help Center 3 01-26-2004 09:34 AM


All times are GMT -4. The time now is 12:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.