Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rating: Thread Rating: 45 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 08-26-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Confused with IcePack

Hello.

I was able to get my Ice project going the standard client and server mechanism where the in the client, the IP address of the server is explicitly declared during initialization or direct binding.

So now, I want to use the IcePack facility ... unfortunately, I'm getting bewildered with the documentation and when I looked into the IcePack Hello demo ... I got more confused.

As a background, what I want to do are two things:
1. Indirect binding with one server adapter and many clients.
2. Indirect binding where on one server, I'll run multiple copies of my Ice server application but with different (but well defined) adapter names. ex. jsockets01, jsockets02, jsockets03, etc. Of course the clients should be able to connect to specific adapters that they need.
NOTE: I dont need IcePack NODES. I manually start the servers.

So what am I confused about? Well, I'll list them:
1. What to put into the config file?
- I understand the the config file should be passed as parameter to the icepackregistry program but what do I put into it to address my requirements.

2. How do I change the server so that it would use this facility?
- I currently initialize my server with the following code:
Quote:
Ice::ObjectAdapterPtr adapter =
communicator()->createObjectAdapterWithEndpoints(
"jclCommandAdapter", "default -p 7012 -z");
Ice::ObjectPtr object = new jSocketsI;
adapter->add(object,
Ice::stringToIdentity("jclCommand"));
adapter->activate();
The IcePack/Hello demo shows that to initialize the server:
Quote:
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");

string id = communicator()->getProperties()->getProperty("Identity");

Ice::ObjectPtr object = new HelloFactoryI();
adapter->add(object, Ice::stringToIdentity(id));
adapter->activate();
but checking the CONFIG file that came with the demo, theres no declaration for the adapter called "Hello". In my case, I sort of want to dynamically change the name during startup that I would have 10 servers with adapter names like jsocket01 to jsocket10.

3. How do I change the client initialization to use the IcePack adapter?
- I initialize the client codes with this:
Quote:
// Create a proxy for the root directory
std::string proxy;
proxy+= "jclCommand:default -h ";
proxy+= hostname;
proxy+= " -p 7012 -z";

Ice::ObjectPrx base = ic->stringToProxy(proxy);
unfortunately, I'm having a hard time understanding again the docs and the sample in IcePack/Hello/Client.cpp file is no help.

Can somebody explain what is actually required in a straight forward manner?

Thanks for any help.

Alex

P.S.
I think I need to sleep. Its already 3:15am and I'm tired and grouchy.
Reply With Quote
  #2 (permalink)  
Old 08-26-2003
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,475
Re: Confused with IcePack

Quote:
Originally posted by amrufon
Hello.

I was able to get my Ice project going the standard client and server mechanism where the in the client, the IP address of the server is explicitly declared during initialization or direct binding.

So now, I want to use the IcePack facility ... unfortunately, I'm getting bewildered with the documentation and when I looked into the IcePack Hello demo ... I got more confused.

As a background, what I want to do are two things:
1. Indirect binding with one server adapter and many clients.
2. Indirect binding where on one server, I'll run multiple copies of my Ice server application but with different (but well defined) adapter names. ex. jsockets01, jsockets02, jsockets03, etc. Of course the clients should be able to connect to specific adapters that they need.
NOTE: I dont need IcePack NODES. I manually start the servers.

So what am I confused about? Well, I'll list them:
1. What to put into the config file?
- I understand the the config file should be passed as parameter to the icepackregistry program but what do I put into it to address my requirements.
You need to put the following properties in the IcePack registry configuration file (let's assume it's called config_icepack):

Code:
IcePack.Registry.Client.Endpoints=default -p 11000
IcePack.Registry.Server.Endpoints=default
IcePack.Registry.Admin.Endpoints=default
IcePack.Registry.Data=<path to the directory of the IcePack registry database directory>
IcePack.Registry.DynamicRegistration=1
The endpoint properties will configure IcePack endpoints, only the client endpoint needs to have a fixed port. The database directory must exist to start the registry. The DynamicRegistration property needs to be set to 1 to allow non-registered adapters to be added when they are activated. Start the IcePack registry with this configuration file in a terminal:

bash$ mkdir db
bash$ icepackregistry --Ice.Config=config_icepack

Quote:

2. How do I change the server so that it would use this facility?
I would change your server code to the following:

Code:
 Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("jclCommandAdapter");
 Ice::ObjectPtr object = new jSocketsI;
 adapter->add(object, Ice::stringToIdentity("jclCommand"));
 adapter->activate();
Then you start each server with the following configuration file (let's assume it's called config_server):

Code:
jclCommandAdapter.Endpoints=default -z
jclCommandAdapter.AdapterId=jsocket01
Ice.Default.Locator=IcePack/Locator:default -h <registry host name> -p 11000
Of course, you need to change the AdapterId property for each of your servers and "<registry host name>" should be replaced by the host name where the IcePack registry is running. Start each server with this configuration file (i.e.: by passing the --Ice.Config=config_server command line argument).

Quote:


3. How do I change the client initialization to use the IcePack adapter?

I would recommend to use a property in your client to configure the proxy of the object you want to use:

Code:
// Create a proxy for the root directory
std::string proxy = ic->getProperties()->getProperty("Proxy");
Ice::ObjectPrx base = ic->stringToProxy(proxy);
In your client configuration file (let's assume it's called config_client), you need to set the following properties:

Code:
Proxy=jclCommand@jsocket01
Ice.Default.Locator=IcePack/Locator:default -h <registry host name> -p 11000
Start your client with this configuration file (i.e.: by passing the --Ice.Config=config_client command line argument...).

Quote:


unfortunately, I'm having a hard time understanding again the docs and the sample in IcePack/Hello/Client.cpp file is no help.

Can somebody explain what is actually required in a straight forward manner?

Thanks for any help.
Yes, forget about the IcePack/Hello demo . This demo demonstrates the use of the IcePack registry, node and deployment mechanism which is a little more complicated than just using the registry with manually launched servers.

The Ice/hello demo actually contains some configuration to use the hello world demo in a similar scenario (i.e.: indirect binding, manually launched server). Here's some instructions on how to use it (I assume your current directory is Ice-1.1.0/demo/Ice/hello):
  • In a terminal, start the IcePack registry:
    bash$ mkdir db
    bash$ icepackregistry --Ice.Config=config
  • Edit the demo/Ice/hello/config file to uncomment the last 4 lines (these lines configure the Hello server and client to use the IcePack registry)
  • In another terminal start the server:
    bash$ ./server
  • In another terminal start the client:
    bash$ ./client --Ice.Trace.Location=1

Let me know if these instructions are not clear enough!

Benoit.
Reply With Quote
  #3 (permalink)  
Old 08-27-2003
amrufon's Avatar
amrufon amrufon is offline
Registered User
 
Name: Alex
Organization: IST
Project: jDatabase
 
Join Date: May 2003
Location: Manila, Philippines
Posts: 96
Send a message via Yahoo to amrufon
-->
Hello Benoit,

I really appreciate your help. Things really get clearer after you get some sleep.

I was actually converting my codes as to your suggestion ... unfortunately, I found-out that I dont have the IcePack binaries. I'm using windows and .NET and when I looked at the Visual Studio Solution file that came with version 1.1.0 ... its not defined.

Thanks again for the help.

Alex
Reply With Quote
  #4 (permalink)  
Old 06-09-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 156
Send a message via MSN to OrNot
-->
I am coufused by the property"IcePack.Registry.Server.Endpoints".

The doc said:
Defines the endpoints of the IcePack server interface. The server endpoints must be accessible to Ice servers that are using IcePack to register their object adapter
endpoints.


So I think that these endpoints are used by ice servers to communicate to register their adapters or objects.

According to this idea, I try the fellowing configurations,

------- config--icepackregistry----------
IcePack.Registry.Client.Endpoints=default -p 10006
IcePack.Registry.Server.Endpoints=default -p 10000
IcePack.Registry.Internal.Endpoints=default
IcePack.Registry.Admin.Endpoints=default
IcePack.Registry.Data=db
IcePack.Registry.DynamicRegistration=1


-------- config-client---------------
Hello.Proxy=hello@HelloAdapter
Ice.Default.Locator=IcePack/Locator:default -p 10006


---------config-server------
Hello.Endpoints=tcp:udp:ssl
Hello.AdapterId=HelloAdapter
Ice.Default.Locator=IcePack/Locator:default -p 10000



But When I run the server.exe, I got errors:


.\Outgoing.cpp:359: Ice::ObjectNotExistException:
object does not exist
identity: IcePack/Locator
facet:
operation: getRegistry

It seems that I misunderstood something about the property. Can anyone help me?
Reply With Quote
  #5 (permalink)  
Old 06-09-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,001
The servers configuration file is incorrect. The locator proxy is always set to the client endpoint. The fact that you are configuring a "server" is irrelevant. The "IcePack.Registry.Server.Endpoints" is using for internal communications, and does not need to have a fixed port endpoint -- that is just "default" will work fine.

Regards, Matthew
Reply With Quote
  #6 (permalink)  
Old 06-09-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 156
Send a message via MSN to OrNot
-->
Thanks a lot.

But , I still feel confused by this property. Could you give me some examples in that we have to set the "IcePack.Registry.Server.Endpoints" instead of the default value?

And , How to understand the "Client" and "Server" concepts in this circumstance of icpackregistry?

Sorry,I can not deeply understand the property discribed by the doc due to my English.


Best regards.
Reply With Quote
  #7 (permalink)  
Old 06-09-2005
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,001
An IcePack "client" is an application that uses IcePack the IcePack query interface. This can happen explicitely (namely a direct application call on the IcePack::Query interface), or by the runtime through indirect binding.

An IcePack "server' is an application that is managed by IcePack. That is a server that is described in a deployment descriptor, and then subsequently started either on-demand by an icepacknode, or started by hand if the process is a manual service.

The only circumstance that I can think you'd want to directly set the port on the endpoints other than client (which must run on a fixed port) is if you have some firewall rules within your internal network.

Regards, Matthew
Reply With Quote
  #8 (permalink)  
Old 06-09-2005
OrNot OrNot is offline
Registered User
 
Name: Bin.Li
Organization: GE Healthcare
Project: Enterprise solution
 
Join Date: Jun 2005
Location: Shanghai
Posts: 156
Send a message via MSN to OrNot
-->
Thank you.
I will try to dig into the souce codes to find more answers.
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
confused with IceXML Yunqiao Yin Help Center 2 08-28-2006 11:21 PM
:confused: How to use Ice with other platform on windows, such as Dev-C++, C++Builder rocshaw Help Center 3 11-24-2005 02:48 AM
Confused with IcePack demos Yunqiao Yin Help Center 1 09-04-2005 07:58 PM
IcePack::AdapterNotExistException or IcePack::ServerNotExistException ghost158 Help Center 1 04-19-2005 03:47 AM
Puzzled by IcePack/Locator and IcePack/Query rc_hz Help Center 2 11-13-2004 09:41 PM


All times are GMT -4. The time now is 07:14 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.