Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-20-2008
caihua2007 caihua2007 is offline
Registered User
 
Name: Cai JCH
Organization: Beijing University of Posts and Telecommunications
Project: for stable network communication
 
Join Date: Jan 2008
Location: BeiJing
Posts: 10
How to use IceStorm::Service class?

Hi,
i write a simple example which is used to start IceStorm service in C++ code, but i have a problem , and i don't know how to solve it. The Ice Version is 3.2.0.

this is the my function below:

int main(int argc, char* argv[]){

Ice::ObjectAdapterPtr _topicAdapter;
Ice::ObjectAdapterPtr _publishAdapter;

IceStorm::ServicePtr ISServer;
Ice::Identity ide;
ide.name = "TopicManager";
ide.category = "DemoIceStorm";
string name = "IceStorm";
string db = "db";

Ice::CommunicatorPtr ic;
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
initData.properties->load("config.IceStormServer");
ic = Ice::initialize(initData);

_topicAdapter = ic->createObjectAdapter(name+".TopicManager");
_publishAdapter = ic->createObjectAdapter(name + ".Publish");

ISServer = IceStorm::Service::create( ic, _topicAdapter, _publishAdapter, name, ide, db );

cout << "the IceBox::IceStorm Start!!!" << endl;
int i;
cin >> i;
ISServer->stop();

ic->destroy();
}

this is the config.IceStormServer below:

Ice.Override.ConnectTimeout=10000

Ice.Override.Timeout=20000

Ice.RetryIntervals=5

Ice.Trace.Protocol=1

Ice.Trace.Network=1

IceStorm.InstanceName=DemoIceStorm

IceStorm.TopicManager.Endpoints=default -p 10000

IceStorm.InstanceName=DemoIceStorm

IceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001

IceStorm.Trace.TopicManager=2

IceStorm.Trace.Topic=1

IceStorm.Trace.Subscriber=1

IceStorm.Trace.Flush=1

IceStorm.Flush.Timeout=2000

The function can start successfully ,but when i used publisher.exe and subscriber.exe in Demo/IceStorm/clock to test it , it can't work. and i hope it can work as "icebox --Ice.Config=config.icebox".

This is the trace of the publisher below:

[ 03/20/08 21:02:16.487 Network: trying to establish tcp connection to 127.0.0.1
:10000 ]
[ 03/20/08 21:02:16.523 Network: tcp connection established
local address = 127.0.0.1:55521
remote address = 127.0.0.1:10000 ]

Where is my error or did I misunderstood something?

Last edited by caihua2007 : 03-20-2008 at 10:14 AM.
Reply With Quote
  #2 (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,061
The problem most likely is caused by you not activating the object adapters.

However, note that this isn't really for external use. Why don't you want to use IceBox?
Reply With Quote
  #3 (permalink)  
Old 03-20-2008
caihua2007 caihua2007 is offline
Registered User
 
Name: Cai JCH
Organization: Beijing University of Posts and Telecommunications
Project: for stable network communication
 
Join Date: Jan 2008
Location: BeiJing
Posts: 10
it could work when i add adapter->activate.
Thank you for your help.
Icebox frequently hang up ,and i don't know why ,so i want to start it in the program, maybe i can find the key to figure it out . hehe
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
IceStorm as Windows Service amercieca Help Center 2 10-08-2007 12:56 PM
Suggestion: Service/daemon class for .NET kwaclaw Comments 1 09-04-2007 09:33 PM
Ice::Service Class in C#? amrufon Help Center 7 09-14-2006 05:26 AM
Very busy IceStorm service Nis Baggesen Help Center 11 03-16-2006 04:47 PM
How to trap signal in ICE::Service Class dragzhb Help Center 6 09-15-2004 11:50 PM


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