Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-03-2007
sgsoft's Avatar
sgsoft sgsoft is offline
Registered User
 
Name: Samon Sun
Organization: Northeastern University, China
Project: Study
 
Join Date: May 2007
Location: Shen Yang,China
Posts: 2
About Ice Best Practices:What is the best way to client locating the servant?

have a question about client locating the servant.


My type sysstem has two servants,which are independent to each other.
for instance,at server side:
FooI Servant:
public class FooI:FooDisp_
{
....//no any api will return BarI proxy
}
BarI Servant:
public class BarI:BarDisp_
{
...//no any api will return FooI proxy

}

Server Application:
public class Server:Ice.Application
{
public override int run(string[] args)
{
Ice.ObjectAdapter adapter=new ....
adapter.add(new FooI(),communicator().stringToIdentity("Foo"));
adapter.add(new FooI(),communicator().stringToIdentity("Bar"));
adapter.activate();
communicator().waitForShutdown();
return 0;

}

public static void Main(string[] args)
{
Server app = new Server();
int status = app.main(args, "config.server");
if (status != 0)
{
System.Environment.Exit(status);
}
}

}


At the client,maybe I need to add below lines to client.config file:
Server.Foo=Foo:tcp -h 127.0.0.1 -p 12345:udp -h 127.0.0.1 -p 12345
Server.Bar=Bar:tcp -h 127.0.0.1 -p 12345:udp -h 127.0.0.1 -p 12345


And write below code:
FooPrx fooPrx = FooPrxHelper.
checkedCast(communicator().propertyToProxy("Server .Foo"));

......//do someting

BarPrx barPrx = BarPrxHelper.
checkedCast(communicator().propertyToProxy("Server .Bar"));

......//do someting

Above steps can work well,but I fell there are some smell in these code.
How can I do better?
What is the best way to client locating the servant?
Reply With Quote
  #2 (permalink)  
Old 06-03-2007
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: 947
I'm afraid there is no absolute answer to this problem. It really depends on your application and deployment environment. What you've done certainly works, but it requires that you modify the configuration files each time the objects move which may or may not be very inconvient.

A more flexible solution is to use IceGrid and locate these objects as well-known objects -- there are numerous articles in our Newsletter on IceGrid so I recommend reading them for more insights.
Reply With Quote
  #3 (permalink)  
Old 06-04-2007
sgsoft's Avatar
sgsoft sgsoft is offline
Registered User
 
Name: Samon Sun
Organization: Northeastern University, China
Project: Study
 
Join Date: May 2007
Location: Shen Yang,China
Posts: 2
Thanks very much!

I will read them .
__________________
------------------------------------------------
A Graduate student in Northeastern University, China
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
Unable to implement servant location in Ice for Python cmellon Help Center 1 01-04-2007 03:20 PM
Servant inheritance dashie Help Center 12 01-10-2005 12:35 AM
servant lifetime nsns Help Center 1 11-05-2004 07:04 AM
Help with servant implement minifat Help Center 6 08-18-2004 09:10 PM
question: servant locators raj Help Center 1 12-28-2003 12:50 PM


All times are GMT -4. The time now is 07:36 AM.


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.